Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Lorenz System Solution by Runge-Kutta Method

295 views
Skip to first unread message

Asim Khan

unread,
May 23, 2006, 4:09:10 AM5/23/06
to
Hi..

Can any body help me in providing the code for solving the Lorenz
system by the Runge-Kutta Method in matlab:

Lorenz system is given by:

x'=a(y-x);

y'=cx-xz-y;

z'=xy-bz;

where a=10, b=8/3 and c=28

I would be very thankful for this.

Best regards,
Asim Khan

Maarten van Reeuwijk

unread,
May 23, 2006, 4:35:08 AM5/23/06
to
Hi Asim,

> Can any body help me in providing the code for solving the Lorenz
> system by the Runge-Kutta Method in matlab:

Use ode45. In matlab, type [t,x,y,z] = lorenz(10, 28, 8/3, 100), where the
file lorenz.m contains:

function [t, x, y, z] = lorenz(sigma, r, b, tend)

x0 = [1; 0; 0];
[t, xvec] = ode45(@f, [0, tend], x0);

x = xvec(:, 1);
y = xvec(:, 2);
z = xvec(:, 3);

% Plot of the solution
plot3(x,y,z, 'r-')
xlabel('x')
ylabel('y')
zlabel('z')

function xdot = f(t, x)
xdot= [ sigma * (x(2) - x(1)); ...
r * x(1)-x(1) * x(3) - x(2); ...
x(1) * x(2) - b * x(3) ];
end
end

HTH, Maarten


--
===================================================================
Maarten van Reeuwijk dept. of Multiscale Physics
Phd student Faculty of Applied Sciences
maarten.ws.tn.tudelft.nl Delft University of Technology

mpmt...@gmail.com

unread,
Oct 2, 2012, 12:21:14 PM10/2/12
to

> Hi, can anyone help me in coding
> x'=a(y-x);
>
> y'=cx-xz-y;
>
> z'=xy-bz;

a=10, b=28, c=8/3


integrate these equations with initial conditions of (X0, Y0, Z0)= (0,1,0), using a simplified fourth order runge kutta (rk4) scheme . please don't use ODE45.
0 new messages