Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB.......... Consider the following test script that simulates the throw of two dice: clear; rng(100); outcomes = roll2(10); summary = mytab(outcomes); disp(summary); histogram(outcomes); It generates

MATLAB..........

Consider the following test script that simulates the throw of two dice:

clear;

rng(100);

outcomes = roll2(10);

summary = mytab(outcomes);

disp(summary);

histogram(outcomes);

It generates the following outputs.

image text in transcribed

image text in transcribed

image text in transcribed

>> outcomes outcomes = 10 4 5 7 3 7 10 7 6 6 >> summary summary = 3 4 5 6 7 10 NWNPPP 3 2.5 2 1.5 0.5 0 3 4 5 6 7 8 9 10 To generate the raw output, the following anonymous functions should be written. Note that roll2 should call roll. Function Handle roll2 Inputs Number of trials Outputs Sequence of outcomes that are the sum of two dice rolls Sequence of outcomes for one dice roll roll Number of trials To generate the summary, the following functions should be written in an m file. Function Name mytab Inputs Sequence of outcomes of the sum of two dice rolls Outputs Tabulated results (frequency count), with two columns Column 1 is the outcome (2, 3, ... 12) and column 2 is the frequency count. A vector containing only the unique elements, that are sorted using MATLAB's sort function. unique (a subfunction in the m file) Sequence of outcomes of the sum of two dice rolls

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

Exposure to SQL desirable but not required

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago