This is the 4d Lorenz equation. how to solve it on Matlab?
3 ビュー (過去 30 日間)
古いコメントを表示
dx/dt=y+y^2-a*y*z;
dy/dt=-z^2+b*y*z-u;
dz/dt=x*y;
du/dt=-c*x;
2 件のコメント
回答 (1 件)
Yongzhen Mi
2021 年 7 月 26 日
Hi, Nix Jr. I think the error is that you defined four variables in your differential equations, but you provided only three initial values to the ode45 function. Therefore, ICs should be something like this [5, 5, 5, 5]' (column vector better).
In addition, you can transfer parameters into the target function by using [time, fOUT]=ode45(@(x)test(~,x,a,b,c), t, ICs, OPTs);. In this way, the parameters a, b, and c can be claimed in the main function once, instead of being defined again and again when the target function is called.
2 件のコメント
Yongzhen Mi
2021 年 7 月 26 日
編集済み: Yongzhen Mi
2021 年 7 月 26 日
Take this as an example:
a = 5;
b = 20;
c = 1;
d = 0.1;
k = 0.1;
e = 20.6;
h = 1;
F = @(t,Y) [a*(Y(2)-Y(1))-e*Y(4);Y(1)*Y(3)-h*Y(2);b-Y(1)*Y(2)-c*Y(3);k*Y(2)-d*Y(4)];
CI = [3.2 8.5 3.5 2.0]';
T = linspace(0,100,3000);
[t,Y]=ode45(F,T,CI);
plot3(Y(:,1),Y(:,2),Y(:,3))
I drew some pictures and the attractors could be observed. Please try again and hopefully this will work.
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!