solving a second order linear differential equation
古いコメントを表示
hello everybody, I was trying to solve a simple pendulum second order linear differential equation of the form y''=-(g/l)*sin(y) while using the ode45 function. since it's a second order equation I understood that I have to manipulate the problem, so it will fit the ode45.
The mathematical manipulation I did is described in the attached picture.

I can't understand why my code fails...please help
g=9.8;
l=0.5;
t_span=[0 30];
teta0=deg2rad(60);
F=@(t,q) [q(2);-(g/l)*sin(q(2))];
[t,q]=ode45(@(t,q) F(t,q),t_span,teta0)
採用された回答
その他の回答 (1 件)
カテゴリ
ヘルプ センター および File Exchange で Numerical Integration and Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!