Question: Write a MATLAB function called diceroll that estimates the outcome of rolling a pair of dice multiple times. The function header should look like this

 Write a MATLAB function called diceroll that estimates the outcome of

Write a MATLAB function called diceroll that estimates the outcome of rolling a pair of dice multiple times. The function header should look like this function sevens-diceroll(n) n is the number of times within the function you will simulate rolling two dice. Every time you roll the dice you should update the outcome so at the end you have a record of the number of times different values showed up. For instance, if n- 10 the simulation might have found: 2 occurred 0 times 3 occurred 1 time 4 occurred 1 time 5 occurred 2 times 6 occurred 0 times 7 occurred 3 times 8 occurred 1 time 9 occurred 0 times 10 occurred 1 time 11 occurred 0 times 12 occurred 1 time After completing the simulation of rolling the dice n times the function should create a bar graph (hint- instead of plot(x,y) use bar(x,y), where the x axis is the 11 possible outcomes (2-12) and the y axis is the number of times each value occurs. The function should then return the number of times 7 was rolled. Remember you must generate each of the two dice rolls separately and add them to get a realistic simulation. Create pseudocode and MATLAB code that performs this task. Then run you function with n=10, 100, and 1000, and submit the resulting graph along with the value it returned (number of sevens rolled) for each of the three simulations

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!