Geometric cumulative distribution function
y = geocdf(x,p)
y = geocdf(x,p,'upper')
y = geocdf(x,p) returns
the cumulative distribution function (cdf) 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
y = geocdf(x,p,'upper') returns the complement
of the geometric distribution cdf at each value in
using an algorithm that more accurately computes the extreme upper
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 three or fewer tails ("failures") before tossing a heads?
To solve, determine the value of the cumulative distribution function (cdf) for the geometric distribution at x equal to 3. The probability of success (tossing a heads) p in any given trial is 0.5.
x = 3; p = 0.5; y = geocdf(x,p)
y = 0.9375
The returned value of y indicates that the probability of observing three or fewer tails before tossing a heads is 0.9375.
The cumulative distribution function (cdf) 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 up to x trials before a success, when the probability of success in any given trial is p.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).