I need to obtain second derivative from a 2nd order ode
Mostrar comentarios más antiguos
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?
Respuesta aceptada
Más respuestas (2)
Friedrich
el 5 de Ag. de 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’’.
1 comentario
Arti
el 5 de Ag. de 2011
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!