How to show he distribution of a random variable Y=X1+X2+……+Xn where X1,X2…,Xn are i.i.d. uniformly distributed random variables?
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Try to show the distribution of a random variable Y=X1+X2+……+Xn where X1,X2…,Xn are i.i.d. uniformly distributed random variables? What can you conclude from the resulting PDF?
0 commentaires
Réponses (1)
Image Analyst
le 26 Nov 2017
Try this:
numRandomNumbers = 1000
numSums = 4;
y = rand(numSums, numRandomNumbers);
sumOfRandomNumbers = sum(y, 1);
subplot(1, 2, 1);
histogram(y);
grid on;
subplot(1, 2, 2);
histogram(sumOfRandomNumbers);
grid on;
Change numSums and see what happens.
4 commentaires
Image Analyst
le 26 Nov 2017
numSums is the number of random numbers you want to sum up. I chose numRandomNumbers = 1000 just so we'd have a good number of numbers from which to get a fairly smooth distribution. So for n = 2, we are going to add two rows together - the first row to the second row, so you'll have 1000 sums, each of which is the sum of two random numbers. Then you take the histogram (distribution) of those 1000 sums and plot them.
For n = 1, the histogram will be a rect function, i.e., flat.
For n = 2, it will be the convolution of 2 rect functions which will be a triangle.
For n = 3 it will be the convolution of a triangle and a rect, which starts looking like a Gaussian.
For each additional n it's like convolving the prior distribution with another rect function.
For larger n it becomes more and more like a Gaussian, as described by the Central Limit Theorem. A rule of thumb is that after about an n of 6 or so, you can approximate the distribution with a Gaussian/Normal distribution, which can make the math easier compute and easier to deal with mathematically because the formula(s) are well known.
Voir également
Catégories
En savoir plus sur Random Number Generation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!