
% demonstrate Central Limit Theorem
   function CLT(n,m)
   tic
   %n=10000; % number of steps in each random walk
   %m=1000; % number of different walks 
   clear x;
   y=zeros(1,m);
   for k=1:m
      x= 2*(rand(1,n))-1;
      y(k)=sum(x);
   end
   figure; hold on; grid on; 
   title('Histogram of where n step random ends')
   hist(y,50)
   figure; hold on; grid on; 
   title('Normalized endpoint of random walk')
   hist(y/sqrt(n),50)
toc


