% plot standard map solutions for a bunch of random initial conditions.
% ian eisenman

M=500; %number of initial conditions
N=400; %number of iterations for each initial condition
K=0.9; %nonlinearity parameter

clf,hold on,axis([0 2*pi 0 2*pi]);xlabel('theta');ylabel('p');title(['standard map, K=' num2str(K)]);
for m=1:M %scroll through initial conditions
x(1)=rand*2*pi;y(1)=rand*2*pi; %create random initial (x,y)
   for n=2:N %iterate map
      x(n)=mod(y(n-1)+x(n-1),2*pi);
      y(n)=mod(y(n-1)+K*sin(x(n)),2*pi);
   end
   %plot map iterations in a random color
   p=plot(x,y,'.','MarkerSize',2);colr=rand(1,3);set(p,'Color',colr)
end
