function   chaos()
%Chaos!! Google Lorenz Equation. Look up comet, plot3 etc.
clear; clf;  disp('Start')
z0=[5 10 15];   tspan = [0 20];

[t zarray] = ode23(@myrhs,tspan,z0);
   x = zarray(:,1); 
   y = zarray(:,2);
   z = zarray(:,3);
   
subplot(2,1,1); 
comet3(x,y,z);  plot3(x,y,z); axis('equal')
subplot(2,1,2); comet(x,y);plot(x,y); axis('equal')
   
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function zzdot = myrhs(t,zz)
 x = zz(1); y = zz(2); z = zz(3);
 
 s = 10;  b = 8/3; r = 96.6; %also try r = 28;
 
 xdot = s*(y-x);
 ydot = x*(r-z) - y;
 zdot = x*y - b*z;

 zzdot = [xdot ydot zdot]';
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
