poissrnd - Poisson random numbers

Syntax

R = poissrnd(lambda)
R = poissrnd(lambda,m)
R = poissrnd(lambda,m,n)

Description

R = poissrnd(lambda) generates random numbers from the Poisson distribution with mean parameter lambda. lambda can be a vector, a matrix, or a multidimensional array. The size of R is the size of lambda.

R = poissrnd(lambda,m) generates random numbers from the Poisson distribution with mean parameter lambda, where m is a row vector. If m is a 1-by-2 vector, R is a matrix with m(1) rows and m(2) columns. If m is 1-by-n, R is an n-dimensional array.

R = poissrnd(lambda,m,n) generates random numbers from the Poisson distribution with mean parameter lambda, where scalars m and n are the row and column dimensions of R.

Example

Generate a random sample of 10 pseudo-observations from a Poisson distribution with λ = 2.

lambda = 2;

random_sample1 = poissrnd(lambda,1,10)
random_sample1 =
   1   0   1   2   1   3   4   2   0   0

random_sample2 = poissrnd(lambda,[1 10])
random_sample2 =
   1   1   1   5   0   3   2   2   3   4

random_sample3 = poissrnd(lambda(ones(1,10)))
random_sample3 =
   3   2   1   1   0   0   4   0   2   0

See Also

random, poisspdf, poisscdf, poissinv, poisstat, poissfit

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS