i want to solve this equation using ode45 with small angle approx theta =sin(theta)
with following initial conditions
and i made this code with m function
function dot = pend_linear(t,var)
dot=[var(1);sin(var(2))*9.81*-1/0.2];
end
and m file to call ode45 and to compare results with analytic solution without any approx.
[t,s]=ode45(@pend_linear,[0;5],[pi/2,0]);
thetan=s(:,1);
thetae=pi/2+49.*(sin(t)-t);%exact solution
plot(t,thetan,'--r',t,thetae,'b')%numerical sol vs exact
and i get these different sol as an answer
which of them is right and what is wrong with false one

回答 (1 件)

Torsten
Torsten 2016 年 5 月 18 日

0 投票

dot=[var(2);-sin(var(1))*9.81/0.2];
Best wishes
Torsten.

2 件のコメント

Mo BO
Mo BO 2016 年 5 月 18 日
編集済み: Mo BO 2016 年 5 月 18 日
:(
Torsten
Torsten 2016 年 5 月 18 日
Yes, your analytical "solution" is obviously not correct.
Best wishes
Torsten.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange で Programming についてさらに検索

タグ

質問済み:

2016 年 5 月 18 日

コメント済み:

2016 年 5 月 18 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by