% This is a sample m-file for projects in MA 486/586 (Statistics) % % This program simulates n=100 values of a normal random variable, % then finds their sample mean, and then repeats this simple % experiment m=10 times. In the end it prints (on the screen) % the computed means (all m=10 values). % % To use it, type "means" in the MATLAB window, the program % will run and you will see 10 computed sample means on the screen % % Nikolai Chernov, 01-25-2004 % m=10; n=100; % M=zeros(m,1); % % here is a loop running over m times % for i=1:m % starts the loop X=randn(n,1); % generate a random vector of size n times 1 u=mean(X); % finds the mean value of the sample X M(i)=u; % saves the mean value to the current position of M end % ends the loop M % prints the components of the vector M