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

When a fair die is rolled, the number uppermost is equally likely to be any inte

ID: 3874782 • Letter: W

Question

When a fair die is rolled, the number uppermost is equally likely to be any integer between 1 and 6. MATLAB randi function generates uniformly distributed pseudorandom integers. Use this documented MATLAB program (dietoss.m) to simulate a fair die roll of N = 10,100,1000 and 10,000 times. For each trial, count the number of sixes thrown by constructing a logical vector and counting the number of times 6 appears. Use MATLAB's vectorizing commands for logical operators in your solution. Estimate the probability of throwing a six by dividing the number of sixes by 10, 100, 1000 and 10,000 respectively. Compare each to the theoretical expected value of 1/6. An ideal diode blocks the flow of current in the direction opposite that of the diode's arrow symbol. Based upon this property, the diode can be used to make a half-wave rectifier. For an ideal diode, the voltage v_L across the resister load is given by: v_L ={v_x, if v_ > 0 0, otherwise. Write MATLAB program using vectorizing commands and logical operators to plot v_L for ten seconds if the supply voltage is v_x = 3e^-t/3 sin(pi t) Volts.

Explanation / Answer

1

We used the following code to generate our outputs:
%---------------------------CODE------------------------------%

N = 10000
dieThrows = [];
for i = 1:N
    dieThrows = [dieThrows randi(6)];
end

count6 = sum(dieThrows == 6);
fprintf('In %d out of %d throws we got 6 ', count6, N);

%-------------------------------END------------------------------%

So as we can see the when
       N = 10, 6 occured 20% of time
       N = 100, 6 occured 22% of time
       N = 1000, 6 occured 17.7% of time
       N = 10000, 6 occured 17.27% of time

whereas our expected value was 1/6 or 16.67%.

We can observe that, as the N grew, percentage of 6 came closer to expected value.

Champ this is the answer to question 1. I hope you like it. If incase you are facing any difficulties with the answer, please feel free to comment below. I shall be glad to help you.

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