40. In lottery the player has to guess correctly r numbers that are drawn out of n...

Question:

40. In lottery the player has to guess correctly r numbers that are drawn out of n numbers. The probability, P, of guessing m numbers out of the r numbers can be calculated by the expression:

where . Write a user-defined MATLAB function that calculates P. For the function name and arguments, use P = ProbLottery(

m,r,n). The input arguments are m, the number of correct guesses;

r, the number of numbers that need to be guessed; and n, the number of numbers available. Use a subfunction inside ProbLottery for calculating

.

(a) Use ProbLottery for calculating the probability of correctly selecting 3 of 6 numbers that are drawn out of 49 numbers in a lottery game.

(b) Consider a lottery game in which 6 numbers are drawn out of 49 numbers.

Write a program in a script file that displays a table with seven rows and two columns. The first column has the numbers 0, 1, 2, 3, 4, 5, and 6, which are the number of numbers guessed correctly. The second column show the corresponding probability of making the guess.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: