Question

Consider tossing two dice with faces labelled 1, 2 and 3. (a) What is the probability...

Consider tossing two dice with faces labelled 1, 2 and 3. (a) What is the probability distribution of the sum of the values? (b) Use Matlab to simulate the tossing of these 2 dice for 10,000 times. Plot the histogram of the sum face values. From the simulation, estimate the probability of the sum face values in part (a). (Hint: use the function randi() to simulate pseudorandom integers.)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a)

There are 2 die with faces labelled 1, 2 and 3
Total possible combinations of tossing 2 die = 3*3 = 9
Possible sum obtained by tossing 2 die : {2,3,4,5,6}
Total possible combinations of obtaining sum 2 : {{1,1}} = 1/9
Total possible combinations of obtaining sum 3 : {{1,2},{2,1}} = 2/9
Total possible combinations of obtaining sum 4 : {{2,2},{1,3},{3,1}} = 3/9
Total possible combinations of obtaining sum 5 : {{2,3},{3,2}} = 2/9
Total possible combinations of obtaining sum 6 : {{3,3}} = 1/9

Probability distribution is P(x):
   1/9 , if x={2,6}
   2/9 , if x={3,5}
   3/9 , if x={4}
  

(b)


% Matlab script to simulate the tossing of 2 dice(3 sided) for 10,000 times
% Plot the histogram of the sum face values.
% From the simulation, estimate the probability of the sum face values

% get the result of sum of simulating 2 3-sided die 10,000 times
rolling_2_dice_sum = randi([1,3],1,10000)+randi([1,3],1,10000);
% vector to contain the frequency of occurence of the each possible sum
count_sum_face_values = zeros(1,5);
% loop to get the number of times each sum occurs
for i=1:length(rolling_2_dice_sum)
count_sum_face_values(rolling_2_dice_sum(i)-1)= count_sum_face_values(rolling_2_dice_sum(i)-1) + 1;
end
% calculate the probability distribution of the sum face values
probability_dist = count_sum_face_values ./ sum(count_sum_face_values);
% output the probability distribution of the sum face values
fprintf('Probability distribution :\n%10s %10s\n','Sum','Count');
for i=1:length(count_sum_face_values)
fprintf('%10d %10.4f\n',(i+1),probability_dist(i));
end
% plot the histogram bar chart
bar((2:6),count_sum_face_values);
title('Histogram of the sum face values');
xlabel('Sum');
ylabel('Frequency of occurrence');
%end of script

Output:

Add a comment
Know the answer?
Add Answer to:
Consider tossing two dice with faces labelled 1, 2 and 3. (a) What is the probability...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT