Question: It's matlab coding only Write a MATLAB script to simulate tossing coins. First ask the user how many times (call it n) he/she wants to
Write a MATLAB script to simulate tossing coins. First ask the user how many times (call it n) he/she wants to toss the coins. Use randi function to generate random integers of 1 or 2. Assume 1 represents Heads and 2 represents Tails. 1. Toss a coin n times and calculate how many times it lands Heads up. 2. Toss two coins simultaneously n times and calculate how many times they land the same (both Heads up or both Tails up). 3. Toss three coins simultaneously n times and calculate how many times at least one of them lands Heads up. Run your code for n = 10, 100, 1000 and report the results using fprintf Hint: To answer part 3, it is easier to calculate the complimentary event (How many times none of the three coins land Heads up, or in other words, how many times all three coins land Tails up)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
