Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Binomial probability density function

`Y = binopdf(X,N,P)`

`Y = binopdf(X,N,P)`

computes
the binomial pdf at each of the values in `X`

using
the corresponding number of trials in `N`

and probability
of success for each trial in `P`

. `Y`

, `N`

,
and `P`

can be vectors, matrices, or multidimensional
arrays that all have the same size. A scalar input is expanded to
a constant array with the same dimensions of the other inputs.

The parameters in `N`

must be positive integers,
and the values in `P`

must lie on the interval [0,
1].

The binomial probability density function for a given value *x* and
given pair of parameters *n* and *p* is

$$y=f(x|n,p)=\left(\begin{array}{c}n\\ x\end{array}\right){p}^{x}{q}^{(n-x)}{I}_{(0,1,\mathrm{...},n)}(x)$$

where *q* = 1 – * p*.
The result, *y*, is the probability of observing *x* successes
in *n* independent trials, where the probability
of success in any *given* trial is *p*.
The indicator function *I*_{(0,1,...,}_{n}_{)}(*x*)
ensures that *x* only adopts values of 0, 1, ..., *n*.

A Quality Assurance inspector tests 200 circuit boards a day. If 2% of the boards have defects, what is the probability that the inspector will find no defective boards on any given day?

binopdf(0,200,0.02) ans = 0.0176

What is the most likely number of defective boards the inspector will find?

defects=0:200; y = binopdf(defects,200,.02); [x,i]=max(y); defects(i) ans = 4

Was this topic helpful?