How do I calculate PMF with the random numbers I generated?
Show older comments
So there are two dice, the first being X1 and the second being X2, that are rolled 1,000,000 times. I'm trying to find the PMF of the minimum number in each role, meaning for each number (1 through 6) what is the probability that number will be the smallest number rolled between the two dice. I know how to generate the random numbers and have used the min function to create a 1x1,000,000 matrix containing the smallest number of each role. Is there a pmf function that I can use on this matrix and, if so, how do I use it and plot it?
Accepted Answer
More Answers (1)
David Hill
on 24 Apr 2020
x=randi(6,1000000,2);
y=min(x,[],2);
histogram(y,6,'BinMethod','integer');
1 Comment
deprove55
on 24 Apr 2020
Categories
Find more on Univariate Discrete Distributions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!