Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

MATLAB In lottery the player has to guess correctly r numbers that are drawn out of n numbers. The probability, P, of guessing m numbers

MATLAB

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.

P = (C(r,m) * C[(n-r),(r-m)] ) / C(n,r)

Where,

C(x,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 C(x,y).

A) use ProbLottery for calculating the probability of correctly selecting 3 of 6 the numbers that are draw 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 row sand two columns. The first column has the numbers 0, 1, 2, 3, 4, 5, 6, which are the number of numbers guessed correctly. The second column show the corresponding probability of making the guess.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions