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 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Image Analyst
2017-11-26
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 个评论
Image Analyst
2017-11-26
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!