Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In MATLAB, the command rand generates a single random number on [0, 1] according to the uniform law. Try it. The command rand (m,
In MATLAB, the command rand generates a single random number on [0, 1] according to the uniform law. Try it. The command rand (m, 1) generates a column vector of length m where each entry is generated independently according to the uniform law. Try it with m = 37. If we set x = (rand < .32), the variable x will be either 0 (if the random number is greater than 0.32) or 1 (if the random number is less than .32). It shouldn't be hard to see that x = 1 with probability 0.32 and x = 0 with probability 0.68. Similarly, x = (rand(37,1) < .32) will create a vector of 37 variables, each of which is 1 or 0 with probability 0.32 or 0.68, respectively. It should be clear how to generalize this to vector lengths other than 37 and probabilities other than 0.32. So if I tell you that basketball player Dwight is a 45% free throw shooter, you can simulate a sequence of 100 free throws with FT (rand(100,1) < .45); The entry FT (k) will be 1 if Dwight made free throw number k, and 0 if he missed. The result of sum (FT) will tell you the total number of free throws out of the 100 that Dwight made. (a) Write a MATLAB function free throws.m that takes a probability p and a positive integer N and returns a simulated sequence of free throws of length N, with a probability of success p. (b) Use your function to estimate the probability that Dwight makes at least 5 of his next 10 free throws. This will require you running it many times (say at least 10,000) and collecting the results in a smart way. (c) Use your script to estimate the probability that Dwight makes at least 50 of his next 100 free throws. (d) Use your script to estimate the probability that Dwight makes at least 500 of his next 1000 free throws.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started