% Integrate the Rossler equations.

% Rossler, O. E., 1976, An equation for continuous chaos, Physics
% Letters A, 57, 397.

% Equations:
% \dot{x}(1) = -(x(2) + x(3))
% \dot{x}(2) =   x(1) + a*x(2)
% \dot{x}(3) =   b + x(3)*(x(1) - c)

% Written by Jim Hansen, Feb 2003 for 12.990 students

% Specify the dimension of the system
dim = 3;

% Specify the initial conditions
x = [1 2 3];

% Specify the parameter values (a, b, and c)
par = [0.15 0.20 10.0];

% Specify the integration step size
h = 0.01;

% Specify the length of integration
steps = 2^12;

% Integrate the equations over length steps to remove any transient behavior
for i=1:steps
 xout=step_it('derivsros',x,par,h,dim);
 x=xout;
end

% Integrate the equations over length steps and record state for plotting
for i=1:steps
 xout=step_it('derivsros',x,par,h,dim);
 state(i,:)=xout;
 x=xout;
end

% Make a pretty picture
figure;plot3(state(:,1),state(:,2),state(:,3)'.');
title('The Rossler attractor');
xlabel('x');ylabel('y');zlabel('z');

print -djpeg90 ros.jpg
