I need to obtain second derivative from a 2nd order ode
Mostra commenti meno recenti
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?
Risposta accettata
Più risposte (2)
Friedrich
il 5 Ago 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 Commento
Arti
il 5 Ago 2011
Categorie
Scopri di più su Ordinary Differential Equations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!