Main Content

Binomial probability density function

computes the binomial probability density function at each of the values in
`y`

= binopdf(`x`

,`n`

,`p`

)`x`

using the corresponding number of trials in `n`

and probability of success for each trial in `p`

.

`x`

, `n`

, and `p`

can be
vectors, matrices, or multidimensional arrays of the same size. Alternatively, one or more
arguments can be scalars. The `binopdf`

function expands scalar inputs to
constant arrays with the same dimensions as the other inputs.

`binopdf`

is a function specific to binomial distribution. Statistics and Machine Learning Toolbox™ also offers the generic function`pdf`

, which supports various probability distributions. To use`pdf`

, specify the probability distribution name and its parameters. Alternatively, create a`BinomialDistribution`

probability distribution object and pass the object as an input argument. Note that the distribution-specific function`binopdf`

is faster than the generic function`pdf`

.Use the

**Probability Distribution Function**app to create an interactive plot of the cumulative distribution function (cdf) or probability density function (pdf) for a probability distribution.