% Program to Calculate Asymptotic Sampling Distribution % Parameters clc; n = 10; loops = 5000; zmat = zeros(loops,1); % Draw and Store Random Values for i = (1:1:loops) x = rand(n,1); y = sortrows(x,1); yn = y(n); zn = n*(1-yn); zmat(i) = zn; end % Graph Sampling Distribution hold on; histogram(zmat,25,'Normalization','pdf'); title(['Simulated Asymptotic Exponential Sampling Distribution with n = ', num2str(n)]); % Superimpose Standard Normal Probability Distribution xvalues = (0:0.01:5); f = exp(-xvalues); plot(xvalues,f);