Solving lorenz equations by runge kutta and euler method

Jean-Baptiste Bordellier jean.baptiste.bordellier at gmail.com
Mon Mar 15 18:26:32 CET 2010


Hello.
I'm trying to make a comparison between diverse methods for solving
differential equation.
I cannot use ode or any related command since the aim is to get a proper
code which will help me compare the efficiency of the methods.
I open a discussion  on usenet.
http://groups.google.fr/group/comp.soft-sys.math.scilab/browse_thread/thread/875cb3e8e2e80c09?hl=fr#
So war i got.

// Set the value of h to chose a step size.
h=0.001;
//set the value of imax to chose the number of iteration.
imax=200;

//Set the values of Xo, Yo, and Zo which are inital condition
Xo=10;
Yo=10;
Zo=10
Unit=[Xo;Yo;Zo];
//Set values of sigma=s, r and beta=b
s=10;
r=28;
b=2.67;

fdx=mopen('C:\lorenz attractor\Lorenz attractorx.txt','wb')
for i=1:imax,
  X=Xo+(-s*Xo+s*Yo)*h;
  Y=Yo+(-Xo*Zo+r*Xo-Yo)*h;
  Z=Zo+(Xo*Yo-b*Zo)*h;
  Xo=X;
  Yo=Y;
  Zo=Z;
  save(fdx,X,Y,Z),  // save data in file
 end
  mclose(fdx)

  fdx=mopen('C:\lorenz attractor\Lorenz attractorx.txt','rb')

  for k=1:imax, load(fdx,'X','Y','Z');X;end  // read data from file
  for k=1:imax, load(fdx,'X','Y','Z');Y;end
  for k=1:imax, load(fdx,'X','Y','Z');Z;end
mclose(fdx);

The problem is that I cannot obtain the values of X, Y and Z as a vector.
I need that in order to plot 2d and 3d graphs of the lorenz equation.

If anybody as any clue please let me know.
Kind regards from France.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20100315/b5d98e5f/attachment.htm>


More information about the users mailing list