% % script to plot average of Cauchy random variables % this to illustrate that the mean of a cauchy pdf % does not converge and is undefined % % note: matlab has no pdf for cauchy, but it is the x/y where % x,y are normal(0,1) random variables. % % Nasser Abbasi oct 20, 2007 for Math 502, CSUF % close all; randn('state',010101); N = 1000; %number of random variables to generate s = 1:1:N; x = randn(N,1); %generate N normal r.v. y = randn(N,1); %generate N normal r.v. z = x./y; av=cumsum(z)./s'; plot(s,av,'.','MarkerSize',5); xlabel('Number of random variables'); ylabel('average of random variables'); title('Average of cauchy r.v. as function of N');