Did you see my advice to your classmate: http://www.mathworks.com/matlabcentral/answers/54410#answer_66109 You have to get the histogram, then divide by the number of counts in the histogram. For the second scenario, what values of the sum will you have if all 5 dice have the same value: 1, 2, 3, 4, 5, or 6? Think about it. What's the sum if all 5 dice are = 1? Then you just have to read off those 5 numbers from the histogram.
Dice Probability on Matlab...so lost!!
3 次查看(过去 30 天)
显示 更早的评论
Yatzi is a game played by rolling 5 dice. My function Yatzi simulates the rolling of 5 dice. The function should take one input, N umR olls, the total number of times that the 5 dice will be rolled. The function should have four outputs which give, in order, the relative frequencies (probabilities) of following scenarios:
The 5 dice showing number 1, 2, 3, 4, and 5 two, and only two, dice showing number 2 at least two dice showing number 4 all 5 dice showing identical number This is what I have so far, but I have no idea how to proceed. help please!
function = Yatzi (NumRolls)
roll(rerolls) = randi(6,[5 length(rerolls)]);
if( result(1) == result(2) &&
result(2) == result(3) &&
result(3) == result(4) &&
result(4) == result(5) )
end
0 个评论
回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!