| Statistics Toolbox | Search  Help Desk |
| geornd | Examples |
Random numbers from the geometric distribution.
Syntax
R = geornd(P) R = geornd(P,m) R = geornd(P,m,n)
Description
The geometric distribution is useful when you want to model the number of failed trials in a row before 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. 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. The scalars m and n are the row and column dimensions of R. The parameter 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