I need the Matlab code for this: 1. Write a program that counts through every pe
ID: 3793409 • Letter: I
Question
I need the Matlab code for this:
1. Write a program that counts through every permutation of four six sided dice and find the total of
the three highest valued dice.
A. Calculate the permutations of rolling four six sided dice
B. Plot a histogram of the totals
C. Calculate the mean and standard deviation of the totals
D. Plot a histogram of the values for the lowest valued, second lowest, third lowest, and highest value dice
2. Write a program that performs multiple die rolls using a random number generator.
Each die must be assigned an integer value between 1 and 6 inclusive, with uniform probability for each value. For
each simulated roll, find the total of the three highest valued dice. Keep a count of the number of times each outcome occurs.
A. Plot a histogram of the totals when the number of iteration is 10,000
B. Plot a histogram of the totals when the number of iteration is 1,000
C. Plot a histogram of the totals when the number of
Explanation / Answer
firstdie = 1:6
seconddie = firstdie
thirddie = seconddie
fourthdie = firstdie
permutation = 1,
for firstdie = 1:6,
for seconddie = 1:6,
for thirddie = 1.6,
for fourthdie = 1.6,
throw [ permutation] = firstdie + seconddie +thirddie + fourthdie;
end;end;end;end;
%histogram
plot(1:length(throw),sort(throw));
mean(throw)
std(throw)
%for 2:
help(rand)