Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following variation of the final round of the classic TV game show Let s Make A Deal . There are three doors, and
Consider the following variation of the final round of the classic TV game show Lets
Make A Deal There are three doors, and behind one of them there is a car, while behind
the other two are goats. You are asked to choose one of the doors, and, without loss of
generality, you choose Door Now, the host Monty Hall opens either Door or Door
behind which is a goat. He never opens up the door with the car behind it Monty
now gives you the choice: do you want to stick with Door or switch to the other door.
What should you do Or does it matter?
In this problem we will create a Monte Carlo simulation of the generalized form of the
Monty Hall problem. Instead of three doors, we will have n doors, where n can be any
number of doors
pts The Monty Hall problem requires a good deal of generating random numbers.
We will begin by creating and testing two helper functions to generate random numbers
for us
NOTE: For full credit be sure to use the rand function in the generation of your random
numbers.
a pts Write a Matlab function f randnumab which takes as input two integers
a and b and generates and returns a random integer that is equally likely to take any
value between a and b inclusive Save this function in the file randnum.m
b pts Write a Matlab mfile testrandnum.m that tests the accuracy of your randnum
function. This program should use randnum to generate random numbers be
tween and Store each random number in a vector x it will be of length when
the simulation is done Then display a histogram of the results using the histx:
function.
c pts Write a Matlab function f randnumrejectabc which takes as input
three integers a b and c and generates and returns a random integer that is equally likely
to take any value between a and b inclusive but will not return the value given by c
Save this function in the file randnumreject.m
d pts Write a Matlab mfile testrandnumreject.m that tests the accuracy of your
randnumreject function. This program should use randnumreject to generate
random numbers between and excluding Store each random number
in a vector x it will be of length when the simulation is done Then display a
histogram of the results using the histx: function.
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