coding using matlab, programming homework help

User Generated

begvtn

Programming

Description

simple code for my probability class, i need an explanation with the code instead of a lab report. for more information refer to the document

Unformatted Attachment Preview

EE 3330 Project 2 Central limit theorem 1) Create N random variables (X1, … ,XN) each with L samples. These should be independent and identically distributed. Generate Sn, which will be the sum of these random variables. 2) Find the mean and variance of X1. i.e. µ and σ2. Since the RV’s are iid’s, µ will be the mean of all the other RV’s in this set too. You can verify this by finding the mean of a few other variables. 3) Create the random variable Zn by adding N random variables as : 𝑍𝑛 = 𝑆𝑛 −𝑛𝜇 𝜎 √𝑛 4) Plot the pdf of Zn 5) Repeat steps 3 and 4 for N=10, N=50 and N=100. For each case, repeat for values of L = 100, 1000, 10,000 and 1000,000. 6) Comment on the effects of the various values of L and N. 7) Repeat for each of the three RV’s listed below: Uniform random variable Exponential random variable (lambda = 0.5) Gaussian random variable (mu = 5, sigma = 2) 8) Type a report on your findings. Make it professional!
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Kindly, receive the attached code..eventually, all the code are running.i appreciate for you patient.

SURNAME 1

Student's name
Professor's name
Course
University's affiliate

SURNAME 2

Introduction
The central limit theorem is a basic theorem in statistics which states that that the sample mean
of an adequately large sample (n ≥ 30) from a continuous probably distribution with mean µX
and variance σ2X will follow a normal distribution (Gaussian distribution).The CLT analysis
places no requirement on the form of the parent distribution .In other it doesn’t matter the
distribution of the population from which the sampling is done.

Method
N random variable were created each having L samples .This variable were created in such a
way that they were all independent and identical. In Matlab for loop was utilized to accomplish
to create the variables
Sum sn of all the variable in sample were created.
The mean and the standard deviation of the parent distribution was also determined
The vector Zn

Central Limit Theorem
10-Random variable

clc% clears the command window
NumberOfSample1=100; %specify the sample size 100
NumberOfSample2=1000; %%specify the sample size 1000
NumberOfSample3=10000; %%specify the sample size 10000
NumberOfSample4=1000000;%specify the sample size 1000000
NumberOfRandomVarible1=10; %specify the number of variable N=10
SizeParameter=4;

SURNAME 3

PopulationSize=10000000; %specify the population size
Population=random('Rayleigh',SizeParameter,PopulationSize,1); %population
%ofthe reylegh distribution with a parameter size 2
X1=zeros(NumberOfSample1,NumberOfRandomVarible1);%forms a matrix of
%NumberOfSample1*NumberOfRandomVarible1 matrix with all elements being
%Zeros
%The following for loop create NumberOfRandomVarible1 random variables each with NumberOfSample samples
for i=1:NumberOfRandomVarible1
X1(:,i)=Population(randperm(PopulationSize,NumberOfSample1));
end
X2=zeros(NumberOfSample2,NumberOfRandomVarible1);
for i=1:NumberOfRandomVarible1
X2(:,i)=Population(randperm(PopulationSize,NumberOfSample2));
end
X3=zeros(NumberOfSample3,NumberOfRandomVarible1);
for i=1:NumberOfRandomVarible1
X3(:,i)=Population(randperm(PopulationSize,NumberOfSample3));
end
X4=zeros(NumberOfSample4,NumberOfRandomVarible1);
for i=1:NumberOfRandomVarible1
X4(:,i)=Population(randperm(PopulationSize,NumberOfSample4));
end
% The following four lines compute the sum sn of all the samples
SumPerSample1=sum(X1);
SumPerSample2=sum(X2);
SumPerSample3=sum(X3);
SumPerSample4=sum(X4);
Mu=mean(Population);% Determine the mean for the population from which
%we sampled our data sample
Variance=var(Population);% Determine the variance for the population from which
%we sampled our data sample
Sigma=sqrt(Variance);
Zn1=((SumPerSample1-NumberOfSample1*Mu)./(Sigma*(sqrt(NumberOfSample1))))';

Zn2=((SumPerSample2-NumberOfSample1*Mu)./(Sigma*(sqrt(NumberOfSample2))))';
Zn3=((SumPerSample3-NumberOfSample1*Mu)./(Sigma*(sqrt(NumberOfSample3))))';
Zn4=((SumPerSample4-NumberOfSample1*Mu)./(Sigma*(sqrt(NumberOfSample4))))';
figure
subplot(2,2,1),hist(Zn1,30),title('Distribution of the mean-L=10')
subplot(2,2,2),hist(Zn2,30),title('Distribution of the mean-L=1000')
subplot(2,2,3),hist(Zn3,30),title('Distribution of the mean-L=10000')
subplot(2,2,4),hist(Zn4,30),title('Distribution of the mean-L=1000000')

SURNAME 4

Central Limit Theorem
50-Random variable

clc% clears the command window
NumberOfSample1=100; %specify the sample size 100
NumberOfSample2=1000; %%specify the sample size 1000
NumberOfSample3=10000; %%specify the sample size 10000
NumberOfSample4=1000000;%specify the sample size 1000000
NumberOfRandomVarible1=50; %specify the number of variable N=10
SizeParameter=4;
PopulationSize=10000000; %specify the population size
Population=random('Rayleigh',SizeParameter,PopulationSize,1); %population
%ofthe reylegh distribution with a parameter size 2
X1=zeros(NumberOfSample1,NumberOfRandomVarible1);%forms a matrix of
%NumberOfSample1*NumberOfRandomVarible1 matrix with all elements being
%Zeros
%The following for loop create NumberOfRandomVarible1 random variables each with NumberOfSample samples
for i=1:NumberOfRandomVarible1

SURNAME 5

X1(:,i)=Population(randperm(PopulationSize,NumberOfSample1));
end
X2=zeros(NumberOfSample2,NumberOfRandomVarible1);
for i=1:NumberOfRandomVarible1
X2(:,i)=Population(randperm(PopulationSize,NumberOfSample2));
end
X3=zeros(NumberOfSample3,NumberOfRandomVarible1);
for i=1:NumberOfRandomVarible1
X3(:,i)=Population(randperm(PopulationSize,NumberOfSample3));
end
X4=zeros(NumberOfSample4,NumberOfRandomVarible1);
for i=1:NumberOfRandomVarible1
X4(:,i)=Population(randperm(PopulationSize,NumberOfSample4));
end
% The following four lines compute the sum sn of all the samples
SumPerSample1=sum(X1);
SumPerSample2=sum(X2);
SumPerSample3=sum(X3);
SumPerSample4=sum(X4);
Mu=mean(Population);% Determine the mean for the population from which
%we sampled our data sample
Variance=var(Population);% Determine the variance for the population from which
%we sampled our data sample
Sigma=sqrt(Variance);
Zn1=((SumPerSample1-NumberOfSample1*Mu)./(Sigma*(sqrt(NumberOfSample1))))';
Zn2=((SumPerSample2-NumberOfSample1*Mu)./(Sigma*(sqrt(NumberOfSample2))))';
Zn3=((SumPerSample3-NumberOfSample1*Mu)./(Sigma*(sqrt(NumberOfSample3))))';

Zn4=((SumPerSample4-NumberOfSample1*Mu)./(Sigma*(sqrt(NumberOfSample4))))';
figure
subplot(2,2,1),hist(Zn1,30),title('Distribution of the mean-L=10')
subplot(2,2,2),hist(Zn2,30),title('Distribution of the mean-L=1000')
subplot(2,2,3),hist(Zn3,30),title('Distribution of the mean-L=10000')
subplot(2,2,4),hist(Zn4,30),title('Distribution of the mean-L=1000000')

SURNAME 6

Central Limit Theorem
100-Random variable

clc% clears the command window
NumberOfSample1=100; %specify the sample size 100
Num...


Anonymous
I was stuck on this subject and a friend recommended Studypool. I'm so glad I checked it out!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags