Question: Consider the following experiment: we roll two dice consecutively. The first die is fair. If the first roll is a 1, 2, or 3, we
Consider the following experiment: we roll two dice consecutively. The first die is fair. If the first roll is a 1, 2, or 3, we roll the same die again. If the first roll yields a 4, 5, or 6, then we roll an unfair die with probabilities [0 0 0 1/3 1/3 1/3].
What is the probability of the outcome (1,6) (the first roll is a 1 and the second is a 6)?
What is the probability of the outcome (6,1)?
What is the probability of the outcome (6, 6)?
Please write a matlab script to simulate this experiment. Run 1000 trials of this experiment.
MatLab File so far...
function index =rollDice(prob) prob=geneCumulative(prob); y_init=rand();%generate a Int from [1,6] with fair chance. y_tmp=prob-y_init; index=6; for i =1:6 if(y_tmp(i)>=0) index=i; break; end end
end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
