I need to obtain second derivative from a 2nd order ode
Show older comments
Hi, I solved following 2 coupled 2nd order odes:
m*x"+c1*x'+k1*x=F1
m*y"+c2*y'+k2*y=F2
I used ode45 and obtained x,x',y and y'.
I need to obtain x" too. Can anyone please tell me how can I do so?
Accepted Answer
More Answers (2)
Friedrich
on 5 Aug 2011
0 votes
Hi,
Matlab can solve ODE of first order only. You have to convert your 2nd order ODE to a sytem of coupled 1st order ODE’s. How this is done can be obtained here:
Friedrich
on 5 Aug 2011
I would suggest reading this article:
Your code should look similar to this:
function example
x_0 = [2,2];
tspan = [0,20];
[t,x] = ode45(@my_func,tspan,x_0);
plot(t,x);
function xbar = my_func( t,x )
F_1 = 10;
c_1 = 2;
k_1 = 1;
m = 5;
xbar = [x(2); (F_1 - c_1*x(2) - k_1*x(1))/m];
end
end
Where x(1) is x’ and x(2) is x’’.
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!