Use Matlab to answer the following questions: 1. Fip a fair coin (one side head
ID: 3870827 • Letter: U
Question
Use Matlab to answer the following questions: 1. Fip a fair coin (one side head and one side tail) 10 times, how many times you have head 2. Repeat same test for another 9 times and how many times you have head for each test? 3. If you continuously flip the coin for 100 times, you have head for how manytimes? 4. If you add test results of part 1 and part 2 (flip the coin for 100 times), how many times of head 5. 6. you have? Please discuss the difference between part 3 and part 4. Graphic the results of all tests.Explanation / Answer
Code used to determine the scenario:
m = 10
heads = 0;
tails = 0;
for i = 1:m
if (rand() > 0.5)
heads++;
else
tails++;
end
end
heads
tails
1. heads: 6
tails: 4
2.
heads = 4
tails = 6
------------------
heads = 6
tails = 4
------------------
heads = 5
tails = 5
------------------
heads = 4
tails = 6
------------------
heads = 4
tails = 6
------------------
heads = 5
tails = 5
------------------
heads = 7
tails = 3
------------------
heads = 5
tails = 5
------------------
heads = 7
tails = 3
------------------
3.
heads = 49
tails = 51
4.
summation of part a and b:
heads: 53
tails: 47
5.
In part 4: function was called 10 times where as in part 3, the function was called once and the whole calculation is done using the single randon initilization.
Cheqq protocol allows us to answer only 4sub questions, but to help you, i have answered 5 for you, I hope this helps you :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.