用ode45解微分方程老是提示错误,求帮助。

下面是计算时使用的程序
M: function y=vdp(t,x)
y=[x(2);-929*x(1)^2-162*cos(100*t)]
计算程序:
>> x0=[0.002;0001];t_final=20;
>> options=odeset('RelTol',10^-20,'AbsTol',10^-20);
>> [t1,y1]=ode45('vdp',[0,t_final],x0,options); plot(t1,y1)

 採用された回答

lodaki
lodaki 2022 年 11 月 22 日

0 投票

可以缩小t的区间,t在0.6左右,就是你上面提示的0.67--开始,x2迅速减少。
所以时间过长的话可能不能显示微分方程变化。
x0=[0.002;0001];
ode45(@vdp,[0:0.001:0.6],x0);
grid on

その他の回答 (0 件)

カテゴリ

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

タグ

質問済み:

2022 年 11 月 22 日

回答済み:

2022 年 11 月 22 日

Community Treasure Hunt

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

Start Hunting!