% waterwheel
nu=3;
q=60;
dt=.01;
total=50;
n=floor(total/dt);
x=zeros(n,1);
y=zeros(n,1);
z=zeros(n,1);
t=zeros(n,1);

x(1)=1;
y(1)=1;
z(1)=1;
t(1)=0.0;
for j=2:n
       xx=x(j-1);
       yy=y(j-1);
       zz=z(j-1);
t(j)=t(j-1)+dt;
x(j)=xx+dt*(-nu*xx+yy);
y(j)=yy+dt*(xx*zz-yy);
z(j)=zz+dt*(-xx*yy-zz+q);
end
figure
plot(t,x)
hold on
  plot(t,y)
hold on
  plot(t,z)
figure 
  scatter(x,z,'.')

