Figure 2.20:

A limit cycle for the R\"ossler system, a=b=0.2, c=1.

Code for Figure 2.20

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
21
22
%
% 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 = 100;
npts = 10*tfin;
time = linspace(0, tfin, npts);


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

% chop off the transient and keep just the cycle
w (1:round(0.8*npts),:) = [];
save "rosslercycle.dat" w

rhs.m


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