Write a program to calculate the probability of two fair dice having sum equal to 7. There are two fair dice and we are interested in seeing whether the sum of the two fair dice having sum equal to 7. Use Monte Carlo Simulation.
15 views (last 30 days)
Show older comments
2 Comments
Guillaume
on 15 Jul 2019
You've posted the text of your homework, but haven't actually asked a question.
Hopefully, you're not asking us to do your homework for you (which we won't do).
Accepted Answer
Guillaume
on 15 Jul 2019
Everything is fine with your code (although the calculation of n7 and nAll could be done with no loop at all), except for your calculation of prob where for some reason you multiply two probabilities together, the theoretical probabilty (n7/nAll) and your monte-carlo probability (count/ntrials), which of course doesn't make much sense.
3 Comments
Guillaume
on 15 Jul 2019
If you have another problem then start a new a question, giving as many details as possible.
If this solution solve your current problem to your liking then please accept it.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!