clear all
clf

S = 1000;
N = 1000; %Plot after this many points

x = randn(1,S)*10;
y = randn(1,S)*10;
gi=0;
count=0;

for u=0.1:0.01:1
    for n=1:S
        X = compute_ikeda_trajectory(u, x(n), y(n), N);
    end
    plot(X(:,1),X(:,2))
    hold on
    pause(0.1)
    if mod(count,10)==0
        gi=gi+1;
        drawnow;
        saveas(gcf, ['Final',sprintf('%03d',gi),'.png'])
    end
end
title ('Ikeda Map (one string) 2D');
