%
% Generate random numbers, and look at serial statistics
% 
R=rand(1,4000);
%
R1=R(1:end-2);
R2=R(2:end-1);
R3=R(3:end);
D1=diff(R);
D2=[D1(2:end-1),0,0];
D3=[D1(3:end),0,0];
%
figure(1);
plot3(D1,D2,D3,'k.')
xlabel('R_k-R_{k-1}','FontSize',14)
ylabel('R_{k+1}-R_k','FontSize',14)
zlabel('R_{k+2}-R_{k+1}','FontSize',14)
%
figure(2)
subplot(2,2,1)
plot(R1,R2,'k.')
axis equal square
xlabel('R_k','FontSize',14)
ylabel('R_{k+1}','FontSize',14)
subplot(2,2,3)
plot(R1,R3,'k.')
axis equal square
xlabel('R_k','FontSize',14)
ylabel('R_{k+2}','FontSize',14)
subplot(2,2,2)
plot(D1,D2,'k.')
axis equal square
xlabel('R_k-R_{k-1}','FontSize',14)
ylabel('R_{k+1}-R_k','FontSize',14)
subplot(2,2,4)
plot(D1,D3,'k.')
axis equal square
xlabel('R_k-R_{k-1}','FontSize',14)
ylabel('R_{k+2}-R_{k+1}','FontSize',14)
%
% calculate hostograms (use 100000 points) 
%
R=rand(1,100000);
figure(3)
subplot(2,1,1)
hist(R,50)
xlabel('value of R_k','FontSize',14)
ylabel('count','FontSize',14)
title('histogram of values of RAND','FontSize',14)
subplot(2,1,2)
hist(diff(R),50)
xlabel('value of R_{k+1}-R_k','FontSize',14)
ylabel('count','FontSize',14)
title('histogram of values of DIFF(RAND)','FontSize',14)

