Lorentz equation using the Euler method

3 ビュー (過去 30 日間)
sz
sz 2020 年 5 月 20 日
コメント済み: Kian Halim 2021 年 10 月 5 日
I would like to plot the Lorentz equation using the Euler method.(If possible don't use ODE)
Please give me how to plot it.
for loop seems difficult and i don't understand.
I think the following is completely different
p=10 %初期値
r=28;
b=8/3;
x(1)=10;
y(1)=12;
z(1)=25;
dy(1)=p*y(1)+p*y(2);
dy(2)=-y(1)*y(3)+r*y(1)-y(2);
dy(3)=y(1)*y(2)-b*y(3);
for i=1:length(t)-1;
   y(i+1)=y(i)+v(i)*h
end
plot
  2 件のコメント
darova
darova 2020 年 5 月 20 日
Can you show original equations?
sz
sz 2020 年 5 月 20 日
編集済み: darova 2020 年 5 月 20 日
lorenz equation
Is this ok?
Please take care of me.
% lorenz equation
dx/dt=-px+py
dy/dt=-xz+rx-y
dz/dt=xy-bz p=10, r=28, b=8/3
x(0)=10, y(0)=12, z(0)=25
euler
y(t+h)=y(t)+h y′(t)

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

採用された回答

darova
darova 2020 年 5 月 20 日
Try this solution
  2 件のコメント
A Name
A Name 2021 年 3 月 11 日
I have the same question and I am stuck. I need to use the euler foward time stepping and this is the code i have so far:
could you please help I am not very confident on matlab
%First define sigma=s, rho=r and beta=b for this question
s=10
r=28;
b=8/3;
% lorenz equation
dx/dt=-sx+sy
dy/dt=-xz+rx-y
dz/dt=xy-bz
%Choose initail conditions
x(0)=10, y(0)=12, z(0)=25
y(1,1) = 10;
y(1,2) = 12;
y(1,3) = 25;
for i=1:length(t)-1;
dy(i,1) = s*y(i,1)+s*y(i,2);
dy(i,2) = -y(i,1)*y(i,3)+r*y(i,1)-y(i,2);
dy(i,3) = y(i,1)*y(i,2)-b*y(i,3);
y(i+1,:)=y(i,:)+dy(i,:)*h(i)
end
plot(t,y)
Kian Halim
Kian Halim 2021 年 10 月 5 日
Did you ever get this working?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by