Write and test a MATLAB program that simulates the experiment of rolling two die
ID: 671979 • Letter: W
Question
Write and test a MATLAB program that simulates the experiment of rolling two die. Your program should: (a) Define a 6 by 6 matrix. (b) Fill the matrix with elements whose values are aij = i + j. (c) Prompt the user for a number between 2 and 12. Determine the probability that a roll of two die will result in the number that the user has specified. Repeat until the user provides a negative number as input. (d) Simulate experiments that involve rolling two die. Allow the user to specify the number of times die are to be rolled. Keep track of the number of outcomes for each possible combination. (e) Print out matrices that show the relative frequency of each outcome for experiments that simulate 36, 1000 and 10,000 rolls of the die.
Explanation / Answer
table()
for i:= 2:12
Die := table(i, i)
events = rand(36,1);
for j=1:max(size(events))
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.