Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB, Central Limit Theorem Parts A and B please. Please indicate which MATLAB

ID: 3764633 • Letter: M

Question

MATLAB, Central Limit Theorem

Parts A and B please.

Please indicate which MATLAB programs are being used to generate the date at the end.

Central Limit Theorem Let X_1,X_2, ... be a sequence of iid random variable with finite mean MU and finite variance sigma^2 and let S_n be the sum of the first n random variables in the sequence: S_n = X_1 + X_2 + ... + x_n Let X_i be a continuous uniform random variable taking values in the interval (1,6). Write a MATLAB program to plot the pdf and cdf of S_n. Consider n = 1,5,10,50 and compare your results. Calculate analytically the mean and the variance of X_i and of S_n in part (a). Write a MATLAB program to generate the standard Gaussian random variable with the same mean and variance as S_n Superimpose this plot with the plots from part (a).Use t = 10,000 samples in the above.

Explanation / Answer

%Program: demo.m

%different sizes of input X
N=[1 5 10 50];

%interval (1,6) for random variables
a=1;
b=6;

%to store sum of differnet sizes of input
S=zeros(length(N));
for i=1:length(N)
%generates uniform random numbers in the interval
X = a + (b-a).*rand(N(i),1);
  
%summing up the uniform random variables
for j=1:length(X)
S(i)=S(i)+X(j);
end
end
%plotting cdf
for j=1:length(S)
cdfplot(S);
end
%plotting pdf
pdf_normal = pdf(pd,S);
plot(S,pdf_normal);