Where in my code using runge- kutta four step method did I make a mistake?

조회 수: 2 (최근 30일)
% compute our trajectory
dt = .01;
tspan = 0:dt:4;
Y(:,1) = y0;
yk = y0;
for i=1:length(tspan)
time= i*dt;
ykplus1=rk4singlestep(@(t,y)lorenz(t,y,sigma,beta,rho),dt,time,yk);
Y =[Y ykplus1];
yk = ykplus1;
end
plot3(Y(1,:),Y(2,:),Y(3,:),'b')
  댓글 수: 7
Charles Saulse
Charles Saulse 2021년 2월 11일
?? I don't know how to put it in a file or make one.
Charles Saulse
Charles Saulse 2021년 2월 13일
Thanks, but I found out that I mixed up my code and not saving the code to matlab. But I did get my answer. Thanks

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

채택된 답변

James Tursa
James Tursa 2021년 2월 11일
Type the following at the command line:
edit rk4singlestep.m
Then copy your code into that file and save it.
  댓글 수: 3
Charles Saulse
Charles Saulse 2021년 2월 12일
Good day. When I do that it takes me straight to the code which I wrote already in the editing window.
Charles Saulse
Charles Saulse 2021년 2월 12일
And when i run the code it gives the same error answer.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by