In lottery the player has to guess correctly r numbers that are drawn out of n numbers.
Question:
p = Cr,mC(n-r),(r-m)/Cn,r
where Cx,y = x!/y!(x – y)!. 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 Cx,y.
(a) Use ProbLottery for calculating the probability of correctly selecting 3 of 6 the 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 raws 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 columns 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
Question Posted: