I need to obtain second derivative from a 2nd order ode
8 views (last 30 days)
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?
0 Comments
Accepted Answer
Friedrich
on 5 Aug 2011
So, after rethinking the whole problem it looks that you are doing it 100% right.
You split up the 2nd order ODE into a coupled system of 1st order ODEs. After solving this system you get x, x’, y and y’. Now you want x’’ and y’’. This can be obtained from x’,x,y and y’ since you have a representation of x’’and y’’ through x,x’,y and y’. So this 2nd order ODE gives
m*x"+c1*x'+k1*x=F1
x‘‘ = (F1-ci*x‘-k1*x)/m
Since you know x and x‘ you can get x‘‘.
2 Comments
Shantanu Chhaparia
on 16 May 2022
What if the second order derivative is a function of some other second order derivatives. I basically have a 14 dof second order system I want to obtain all the 14 second order derivatives but they are function of other 2nd order dof. So how to go about that?
More Answers (2)
Friedrich
on 5 Aug 2011
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’’.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!