function standard_map_interactive
% Interactively plot standard map iterations.
% from http://people.uncw.edu/hermanr/chaos/MatLab.htm
% modified by Dorian Abbot.  Click to choose initial conditions.
N     = 500;

axis([0 2*pi 0 2*pi]);
[x(1) y(1) bb]=ginput(1);
hold on
p = plot(x(1),y(1),'.','EraseMode','none','MarkerSize',2); 
while bb<2,
   for n=2:N
      [x(n),y(n)]=standard(x(n-1),y(n-1));
      set(p,'XData',x(n),'YData',y(n))
      drawnow
   end
   [x(1) y(1) bb]=ginput(1);
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [x1,y1]=standard(x0,y0)

k  = 0.7; %nonlinearity parameter
y1 = y0+k*sin(x0);
x1 = y1+x0;
y1 = mod(y1,2*pi);
x1 = mod(x1,2*pi);
