Page 1 of 1

Lorenz Chaos

Posted: Wed Feb 20, 2013 7:14 pm
by CommRLock78
I wrote this Matlab script of Lorenz's chaos for an assignment. Save as lorenz.m to run [NOTE: If you want to use GNU Octave, then the two functions must be split into two files, lorenz.m and Lchaos.m]

The equations are as follows:
x' = s(y - x)
y' = x(t - z) - y
z' = xy - bz

Code: Select all

% HW 4 Problem 1 - Lorenz Chaos
%-------------------------------------------------------
function lorenz;
[t x] = ode45(@Lchaos,[0 50],[5;5;5]); % Initial conditions are the last matrix.
figure(1)
plot(t,x(:,1)),xlabel('t'),ylabel('x'),title('x(t)')
figure(2)
plot(t,x(:,2)),xlabel('t'),ylabel('y'),title('y(t)')
figure(3)
plot(t,x(:,3)),xlabel('t'),ylabel('z'),title('z(t)')
figure(4)
plot(t,x),xlabel('t'),ylabel('x,y,z'),legend('x(t)','y(t)','z(t)')
figure(5)
plot(x(:,1),x(:,2)),xlabel('x'),ylabel('y'),title('xy Phase Plane')
figure(6)
plot(x(:,1),x(:,3)),xlabel('x'),ylabel('z'),title('xz Phase Plane')
figure(7)
plot(x(:,2),x(:,3)),xlabel('y'),ylabel('z'),title('yz Phase Plane')
figure(8)
plot3(x(:,1),x(:,2),x(:,3)),xlabel('x'),ylabel('y'),zlabel('z')

function xprime = Lchaos(t,x);
sig = 10;,tau = 28;,bet = 8/3; % PARAMETERS -- THESE AND INITIAL CONDITIONS CAN BE ADJUSTED
xprime = zeros(3,1);
xprime(1) = sig*(x(2) - x(1));
xprime(2) = x(1)*(tau - x(3)) - x(2);
xprime(3) = x(1)*x(2) - bet*x(3);
For (5,5,5) as the initial conditions, as set in the code above, these two plots struck me as being particularly neat:

Image

Image

Re: Lorenz Chaos

Posted: Thu Feb 21, 2013 5:55 am
by Diziet Sma
I love Chaos Theory.. did you ever read James Gleick's book on the subject? Fascinating overview.

Re: Lorenz Chaos

Posted: Thu Feb 21, 2013 9:10 am
by CommRLock78
Diziet Sma wrote:
I love Chaos Theory.. did you ever read James Gleick's book on the subject? Fascinating overview.
I must confess that any technical knowledge I now have of Chaos theory is only days old - but I understand there have been many many books written about it :).

Re: Lorenz Chaos

Posted: Mon Feb 25, 2013 7:57 pm
by Tricky
CommRLock78 wrote:
Diziet Sma wrote:
I love Chaos Theory.. did you ever read James Gleick's book on the subject? Fascinating overview.
I must confess that any technical knowledge I now have of Chaos theory is only days old - but I understand there have been many many books written about it :).
Read up on the works of [Wikipedia] Benoit Mandelbrot. Also [Wikipedia] J. Glieck as Dizzy has mentioned.

[Wikipedia] Butterfly effect.