Statistics Toolbox | ![]() ![]() |
Random numbers from the geometric distribution
Syntax
Description
The geometric distribution is useful when you want to model the number of successive failures preceding a success, where the probability of success in any given trial is the constant P.
R = geornd(P)
generates geometric random numbers with probability parameter P. The size of R is the size of P.
R = geornd(P,m)
generates geometric random numbers with probability parameter P, where m is a 1-by-2 vector that contains the row and column dimensions of R.
R = geornd(P,m,n)
generates geometric random numbers with probability parameter P, where scalars m and n are the row and column dimensions of R.
The parameters in P must lie on the interval [0 1].
Examples
r1 = geornd(1 ./ 2.^(1:6)) r1 = 2 10 2 5 2 60 r2 = geornd(0.01,[1 5]) r2 = 65 18 334 291 63 r3 = geornd(0.5,1,6) r3 = 0 7 1 3 1 0
See Also
geocdf
, geoinv
, geopdf
, geostat
![]() | geopdf | geostat | ![]() |