FreeMat
RANDP Generate Poisson Random Variable

Section: Random Number Generation

Usage

Generates a vector Poisson random variables with the given parameters. The general syntax for its use is

   y = randp(nu),

where nu is an array containing the rate parameters for the generated random variables.

Internals

A Poisson random variable is generally defined by taking the limit of a binomial distribution as the sample size becomes large, with the expected number of successes being fixed (so that the probability of success decreases as 1/N). The Poisson distribution is given by

\[ P_{\nu}(n) = \frac{\nu^n e^{-nu}}{n!}. \]

Example

Here is an exmaple of using randp to generate some Poisson random variables, and also using randbin to do the same using N=1000 trials to approximate the Poisson result.

--> randp(33*ones(1,10))

ans = 
 39 39 27 27 35 31 29 28 33 25 

--> randbin(1000*ones(1,10),33/1000*ones(1,10))

ans = 
 31 17 42 19 34 36 34 41 30 30