## MathLab question

### 2 PROJECT TASKS Perform the following tasks, then document your results and submit them in written form in accordance with the instructions in Section 3, below. You may use this document as a format. 2.1 Sum of Independent, Identically Distributed (iid) Random Variables from U(0,1) Generate the sum of N random variables distributed for . MATLAB users will use the function rand. Generate a large number of such sums, say 100,000 or more, for each value of . Plot a histogram of the results for each , scaling the histogram appropriately to be a probability density function. In each case, compute the mean and standard deviation of the samples and compare it to the theoretical expected value and variance for an infinitely large ensemble of such sums. N Y = Xk k=1 N ∑ Xk mk 2 s k Y m = mk k=1 N ∑ σ2 = σ k 2 k=1 N ∑ N Xk Xk ~ U(0,1),k = 1,2…,N NNN === 2, 6, 12 N N On the same plot as the histogram, plot an appropriately scaled Gaussian curve with the theoretical mean and variance. Discuss what you did and what you observed and why it does or does not make sense. One plot required for each value of N for a total of three plots. 2.2 Sum of Independent, Identically Distributed (iid) Discrete Random Variables Repeat all the sections of 2.1 where the random variables are generated using randi simulate the rolling of the fair eight-sided dice, followed by the sum of the values from each roll. Repeat this experiment a large number of times to create the histogram of the sum (I’m not interested in the values of the individual rolls!). Repeat the whole process for . For each value of N, compute the mean and standard deviation of the samples and compare it to the theoretical expected value and variance for an infinitely large ensemble of such sums. On the same plot as the histogram, plot an appropriately scaled Gaussian curve with the theoretical mean and variance. Discuss what you did and what you observed and why it does or does not make sense. One plot required for each value of N for a total of two plots 2.3 Sum of Independent, Identically Distributed (iid) Random Variables from Repeat all the sections of 2.1 where the random variables are generated using the function randx provided with Project 1. Use . Note that this pdf has a sharp discontinuity at , but that eventually the histogram does approach the Gaussian! The CLT is a powerful theorem! In each case, compute the mean and standard deviation of the samples and compare it to the theoretical expected value and variance for an infinitely large ensemble of such sums. On the same plot as the histogram, plot an appropriately scaled Gaussian curve with the theoretical mean and variance. Discuss what you did and what you observed and why it does or does not make sense. One plot required for each value of N for a total of three plots. 2.4 Sum of Independent, Identically Distributed (iid) Bernoulli Trials Let a single Bernoulli trial result in either a one (1) or a zero (0), with . Perform independent trials. What is the form of the pmf of the random variable ? (I’m looking for a specific name here, go review the standard pmfs.) Because the random variable is a sum of independent random variables, each of which has finite mean and finite variance, , the CLT should hold. Use values of and as large as you can without causing a MATLAB overflow. Note that is the number of Bernoulli/Binary random variables in the sum. The sum itself produces one value of the random variable . You need to do this process many times to generate your histogram. N N = 2,N = 10,N = 50 0.5 ( ) 0.5 x X px e- = N = 2,N = 10,N = 100 x = 0 Pr 1 0.5 [X = =] N K = number of 1’s in N trials K m = 0.5 2 s = 0.5 N = 4,N = 8, N N K Each figure should consist of two subplots. On the first, plot the (theoretical) probability density function of the sum of independent Bernoulli trials. Plot the CLT Gaussian approximation on the same plot and compare the results. On the second, generate and plot the scaled histogram for the sum of a large number of random trials of the sum of iid Bernoulli experiments and compare it to the theoretical. Plot the CLT Gaussian approximation on the same histogram plot and compare the results. There are three figures, one for each value of N and each figure has two subplots

DETAILED ASSIGNMENT