simple second order ODE solver
Afficher commentaires plus anciens
Hello, I am trying to solve this second order ODE.
(d^2(x)/dt^2)+(dx/dt)+x=0
x(0)=0,x'(0)=1
t=[0 10]
I have tried using ODE 45 and dsolve , however when I always get some kind of error message either regarding my t input or my x''. If anyone has can lend assistance that would be much appreciated. Thanks in advance.
1 commentaire
Réponses (2)
Torsten
le 27 Avr 2016
0 votes
You can't prescribe x''(0) for a 2nd order ODE.
Best wishes
Torsten.
4 commentaires
Derek Bindbeutel
le 27 Avr 2016
syms y(t)
Dy = diff(y);
dsolve(diff(y, 2) + diff(y) + y == 0, y(0) == 0, Dy(0) == 1)
Best wishes
Torsten.
Derek Bindbeutel
le 27 Avr 2016
Torsten
le 27 Avr 2016
No. t will be a variable in the answer.
Solution is here:
Best wishes
Torsten.
function yourIntegration
x0 = [0; 1];
[t, x] = ode45(@YourODE, x0, [0, 10]);
plot(t, x);
function dx = YourODE(t, x)
dx = [x(2) ; ...
-x(2) - x(1)];
Catégories
En savoir plus sur Numeric Solvers dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!