Create N random variables X1 XN each with L samples These s
Create N random variables (X_1, ..., X_N) each with L samples. These should be independent and identically distributed. Generate S_n, which will be the sum of these random variables. Find the mean and variance of X_1. i.e. mu and sigma^2. Since the RV\'s are iid\'s, mu 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. Create the random variable Z_n by adding N random variables as: Z_n = S_n - n mu/sigma squareroot n Plot the pdf of Z_n 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. Comment on the effects of the various values of L and N. 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) Type a report on your findings. Make it professional!
Solution
X1=rand(1,L)
Since there are N random variable, the random numbers can be generated by
X=rand(N,L);
The sum of random variable:
sn=sum(X,2);
2 ) The mean of X1 can found by
mu=mean(X(1,:));
disp(mu);
the mean of X1,X2,X3.. Xn can be found by
mu=mean(X,2);
the variance of X1,X2, X3.. Xn
sigma=var(X,0,2);
// MATLAB CODE
L=10; % no of samples in Random variable
N=10; % no of random variable
X= rand(N,L); % random numbers
sn=sum(X,2); % sum of random variable
mu=mean(X,2); % mean of X
sigma=var(X,0,2); % finding variance
zn= (sn-(mu.*9))/(sqrt(sigma).*sqrt(N)); % finding Zn
plot(zn);
