Function Reference: geoinv

statistics: x = geoinv (p, ps)

Inverse of the geometric cumulative distribution function (iCDF).

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

The geometric distribution models the number of failures (p) 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: geocdf, geopdf, geornd, geofit, geostat

Source Code: geoinv

Example: 1

 

 ## Plot various iCDFs from the geometric distribution
 p = 0.001:0.001:0.999;
 x1 = geoinv (p, 0.2);
 x2 = geoinv (p, 0.5);
 x3 = geoinv (p, 0.7);
 plot (p, x1, "-b", p, x2, "-g", p, x3, "-r")
 grid on
 ylim ([0, 10])
 legend ({"ps = 0.2", "ps = 0.5", "ps = 0.7"}, "location", "northwest")
 title ("Geometric iCDF")
 xlabel ("probability")
 ylabel ("values in x (number of failures)")

                    
plotted figure