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 behind one
Consider the following variation of the final round of the classic TV game show "Let's 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 doors, where 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 randnumab which takes as input two integers a and and generates and returns a random integer that is equally likely to take any value between a and 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 between and Store each random number in a vector it will be of length when the simulation is done Then display a histogram of the results using the hist : function. c pts Write a Matlab function randnumreject which takes as input three integers and and generates and returns a random integer that is equally likely to take any value between a and inclusive but will not return the value given by 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 it will be of length when the simulation is done Then display a histogram of the results using the hist function.
Consider the following variation of the final round of the classic TV game show "Let's 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 doors, where 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 randnumab which takes as input two integers a and and generates and returns a random integer that is equally likely to take any value between a and 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 between and Store each random number in a vector it will be of length when the simulation is done Then display a histogram of the results using the hist : function.
c pts Write a Matlab function randnumreject which takes as input three integers and and generates and returns a random integer that is equally likely to take any value between a and inclusive but will not return the value given by 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 it will be of length when the simulation is done Then display a histogram of the results using the hist function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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