next up previous contents
Next: RANDBIN Generate Binomial Random Up: Random Number Generation Previous: RANDEXP Generate Exponential Random   Contents

Subsections

RANDP Generate Poisson Random Variable

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.

Function 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

$\displaystyle 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 = 
  <int32>  - size: [1 10]
 
Columns 1 to 5
            37             38             44             38             35  
 
Columns 6 to 10
            32             28             38             26             37  
--> randbin(1000*ones(1,10),33/1000*ones(1,10))
ans = 
  <uint32>  - size: [1 10]
 
Columns 1 to 5
           33            38            40            37            31  
 
Columns 6 to 10
           27            26            40            32            28



Samit K. Basu 2005-03-16