Categories &

Functions List

Function Reference: geocdf

statistics: p = geocdf (x, ps)
statistics: p = geocdf (x, ps, "upper")

Geometric cumulative distribution function (CDF).

For each element of x, compute the cumulative distribution function (CDF) of the geometric distribution with probability of success parameter ps. The size of p is the common size of x and ps. A scalar input functions as a constant matrix of the same size as the other inputs.

p = geocdf (x, ps, "upper") computes the upper tail probability of the geometric distribution with parameter ps, at the values in x.

The geometric distribution models the number of failures (x) of a Bernoulli trial with probability ps before the first success.

Further information about the geometric distribution can be found at https://en.wikipedia.org/wiki/Geometric_distribution

See also: geoinv, geopdf, geornd, geofit, geostat

Source Code: geocdf

Example: 1

 

 ## Plot various CDFs from the geometric distribution
 x = 0:10;
 p1 = geocdf (x, 0.2);
 p2 = geocdf (x, 0.5);
 p3 = geocdf (x, 0.7);
 plot (x, p1, "*b", x, p2, "*g", x, p3, "*r")
 grid on
 xlim ([0, 10])
 legend ({"ps = 0.2", "ps = 0.5", "ps = 0.7"}, "location", "southeast")
 title ("Geometric CDF")
 xlabel ("values in x (number of failures)")
 ylabel ("probability")

                    
plotted figure