Geometric probability density function
y = geopdf(x,p)
y = geopdf(x,p) returns
the probability density function (pdf) of the geometric distribution
at each value in
x using the corresponding probabilities
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 as the other input. The parameters in
lie on the interval
Compute Geometric Distribution pdf
Suppose you toss a fair coin repeatedly, and a "success" occurs when the coin lands with heads facing up. What is the probability of observing exactly three tails ("failures") before tossing a heads?
To solve, determine the value of the probability density function (pdf) for the geometric distribution at
x equal to
3. The probability of success (tossing a heads)
p in any given trial is
x = 3; p = 0.5; y = geopdf(x,p)
y = 0.0625
The returned value of
y indicates that the probability of observing exactly three tails before tossing a heads is
Geometric Distribution pdf
The probability density function (pdf) of the geometric distribution is
where p is the probability of success, and x is the number of failures before the first success. The result y is the probability of observing exactly x trials before a success, when the probability of success in any given trial is p. For discrete distributions, the pdf is also known as the probability mass function (pmf).
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Introduced before R2006a