Question: Consider the following script: clear; d = roll_2_dice(10000, 100); [freq, prop] = tabulate_2_dice(d); disp(freq); disp(prop); This generates the following variables: >> whos Name Size Bytes

Consider the following script: clear;

d = roll_2_dice(10000, 100);

[freq, prop] = tabulate_2_dice(d);

disp(freq);

disp(prop);

This generates the following variables: >> whos Name Size Bytes Class Attributes d 1x10000 80000 double freq 1x12 96 double prop 1x12 96 double Where

d is the simulated dice rolls in a row vector.

freq is a 1 x 12 array that contains the frequency of each combination. For example, freq(1) should always be zero, as the minimum combination of rolls is 2 (1+1). You would expect freq(7) to be the highest (1/6 of all outcomes).

prop is a 1 x 12 array that contains the proportions of each outcome.

For example, the outcome of the number seven is shown below. >> freq(7) ans = 1655 >> prop(7) ans = 0.1655 Your task is to implement the functions roll_2_dice and tabulate_2_dice. These are summarised below.

Function Description Inputs Outputs roll_2_dice Generates a simulation of two dice throws, with a specified seed. N seed 1xN vector

tabulate_2_dice Based on a set of dice throws, calculates the frequency and proportion of each outcome. Throws Frequency and proportions tables

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!