improved euler integration using the butterfly effect

조회 수: 1 (최근 30일)
Katerina Polykarpou
Katerina Polykarpou 2020년 3월 26일
댓글: Torsten 2020년 3월 26일
i have created the following code but it appears as error. can someone please help me? thank you
%euler's Method
% Initial conditions and setup
sigma=10;
beta=8/3;
rho=28;
t1=100;
t0=0;
x0=0;%initial x value
y0=1;%initial y value
z0=0; %initial z value
Delta=0.0001;
t=t0:Delta:t1;
i=1;
x=1*ones(1,length(t));
while (i<length(t))
x(i+1)=sigma*(y-(1+Delta));
i=i+1;
end
y=1*ones(1,length(t));
while (i<length(t))
y(i+1)=x*(rho-z)-(1+Delta);
i=i+1;
end
z=1*ones(1,length(t));
while(i<length(t))
z(i+1)=x*y-beta*(1+Delta);
i=i+1;
end
plot(x,y,z);
  댓글 수: 1
Torsten
Torsten 2020년 3월 26일
In the first while loop, y is undefined.
In the second while loop, z is undefined.
Before entering the second and third while loops, you forgot to reset i to 1.
I further think that you will have to use x(i-1), y(i-1) and z(i-1) instead of x,y and z on the right-hand sides of the expressions within the while loops.
If errors persist, please include the error messages.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by