function Lawlargenumbers %demonstration of the law lf large numbers as it applies to the stable laws. z=(1:100000)'; x1=cumsum(normrnd(0,1,100000,1))./z; x2=cumsum(stabrnd(1.7,100000))./z; x3=cumsum(stabrnd(1.3,100000))./z; x4=cumsum(trnd(1,100000,1))./z; %figure semilogx(z,x1,'r',z,x2,'g',z,x3,'b',z,x4,'k') title('Law of Large Numbers for Stable, a=2 (red), a=1.7 (green) a=1.3 (blue%) a=1 (black)') xlabel('n') ylabel('sample mean of n random variables')