File: random_randp.html

package info (click to toggle)
freemat 4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 174,756 kB
  • ctags: 67,023
  • sloc: cpp: 351,059; ansic: 255,892; sh: 40,590; makefile: 4,387; perl: 4,058; asm: 3,313; pascal: 2,718; fortran: 1,722; ada: 1,681; ml: 1,360; cs: 879; csh: 795; python: 430; sed: 162; lisp: 160; awk: 5
file content (50 lines) | stat: -rw-r--r-- 1,312 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>
<HEAD>
<TITLE>RANDP Generate Poisson Random Variable
</TITLE>
</HEAD>
<BODY>
<H2>RANDP Generate Poisson Random Variable
</H2>
<P>
Section: <A HREF=sec_random.html> Random Number Generation </A>
<H3>Usage</H3>
Generates a vector Poisson random variables with the given
parameters.  The general syntax for its use is
<PRE>
   y = randp(nu),
</PRE>
<P>
where <code>nu</code> is an array containing the rate parameters
for the generated random variables.  
<H3>Function Internals</H3>
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 <code>1/N</code>).  
The Poisson distribution is given by
<P>
<DIV ALIGN="CENTER">
<IMG SRC="randp_eqn1.png">
</DIV>
<P>
<H3>Example</H3>
Here is an exmaple of using <code>randp</code> to generate some Poisson
random variables, and also using <code>randbin</code> to do the same
using <code>N=1000</code> trials to approximate the Poisson result.
<PRE>
--&gt; randp(33*ones(1,10))

ans = 
 31 33 34 44 32 29 34 30 32 32 

--&gt; randbin(1000*ones(1,10),33/1000*ones(1,10))

ans = 
 32 36 36 39 33 34 41 33 42 32 
</PRE>
<P>
</BODY>
</HTML>