Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You should use MATLAB to solve the problem below. You have three dice. Each die

ID: 3838060 • Letter: Y

Question

You should use MATLAB to solve the problem below.

You have three dice. Each die has equal probability 1/6 to land on numbers 1,..,6. You roll the dice and record the sum of the three numbers you obtain. If the sum is 3 or 18, you win the game. You always play this game until you win. Let Y denote the number of trials it took you to win (rolling 3 dice is a trial). After 1000 victories you have a vector of 1000 Y values. Plot the histogram of the obtained Y values. Add graphical parameters to your plot and save it as a .jpg le. Compare your histogram with the pdf plot obtained in the previous problem.

Explanation / Answer

NumberOfDices = 3;
NumberOfFaces = 6;
NumberOfRoll = 50;
AllRoll = randi(NumFace, NumRoll, NumDice);
SumRoll = sum(AllRoll, 2);
Bins = (NumberOfRoll:NumberOfFaces * NumberOfDices)';
if ( SumRoll == 3 || SumRoll == 18)
end
hist(SumRoll, Bins);
title(sprintf('Histogram generated from %d rolls of %d %d-sided dice', NumRoll, NumDice, NumFace));
xlabel(sprintf('Sum of %d dice', NumDice));
ylabel('Count');


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote