Quantcast

Documentation Center

  • Trial Software
  • Product Updates

poissrnd

Poisson random numbers

Syntax

R = poissrnd(lambda)
R = poissrnd(lambda,m,n,...)
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,n,...) or R = poissrnd(lambda,[m,n,...]) generates an m-by-n-by-... array. The lambda parameter can be a scalar or an array of the same size as R.

Examples

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

| | | | |

Was this topic helpful?