a=[80 81 101 924 397];
m=2^10;

for i=1:length(a)
figure
x=lcg(1,a(i),1,m,m);
n=length(x);
plot(x(1:n-1),x(2:n),'.');
title(['a=', num2str(a(i)), ', c=1,m=1024   period=', num2str(period(1,a(i),1,2^10))])
xlabel('x(n)')
ylabel('x(n+1)')
pause(1)
end
disp(['Three dimensional graph of the same sequence-hit any key'])
pause

figure
plot3(x(1:(n-2)),x(2:(n-1)),x(3:n),'*');
grid on
title(['a=', num2str(a(i)), ', c=1,m=1024   period=', num2str(period(1,a(i),1,2^10))])
xlabel('x(n-2)')
ylabel('x(n-1)')
zlabel('x(n)')
disp(['rotate the graph, then hit any key to continue'])
pause

figure
x=lcg(1,a(i),1,m,m);
n=length(x);
plot(x(1:n-1),x(2:n),'.');
title(['a=', num2str(a(i)), ', c=1,m=1024   period=', num2str(period(1,a(i),1,2^10))])
xlabel('x(n)')
ylabel('x(n+1)')
disp(['Use a=397,  plot the sequence 20 points at a time (hit any key)'])
pause


figure
x=lcg(1,397,1,m,m);
n=length(x);
xlabel('x(n)')
ylabel('x(n+1)')
for k=0:50
    in=(20*k)+(1:20);
plot(x(in),x(1+in),'.');
hold on
title(['a=397,c=1,m=1024    Total number plotted, 20 at a time= ' num2str(20*(k+1))])
pause(.5)
end
hold off