Figure 2.21:

A strange attractor for the R\"ossler system, a=b=0.2, c=5.7.

Code for Figure 2.21

Text of the GNU GPL.

main.m


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
%
% pass parameters to function, jbr, 6/28/2018

% cycle
%a = 0.2; b = 0.2; c = 1;
% attractor
a = 0.2; b = 0.2; c = 5.7;
p = struct();
p.a = a; p.b = b; p.c = c;

tfin = 750;
npts = 10*tfin;
time = linspace(0, tfin, npts);


%w0 = [0;0;0];
w0 = [1;1;1];
[time, w] = ode15s (@(t, w) rhs(t, w, p), time, w0);

save "rosslerattractor.dat" w

rhs.m


1
2
3
4
5
6
7
function wdot = rhs(t, w, p)
  x = w(1);
  y = w(2);
  z = w(3);
  wdot = [-y - z;
          x + p.a*y;
	  p.b + z*(x - p.c)];