Physics307L F09:People/Mondragon/Poisson/Notebook/20071217: Difference between revisions
(New page: Still some planning and thinking ==what poisson_rnd(lambda, r, c) does== Octave's ''poisson_rnd(lambda, r, c)'' generates a matrix with <math>r</math> rows and <math>c</math> columns of ra...) |
m (1 revision) |
(No difference)
|
Latest revision as of 18:58, 6 August 2010
Still some planning and thinking
what poisson_rnd(lambda, r, c) does
Octave's poisson_rnd(lambda, r, c) generates a matrix with [math]\displaystyle{ r }[/math] rows and [math]\displaystyle{ c }[/math] columns of random integers sampled from a Poisson distribution with parameter [math]\displaystyle{ lambda }[/math], lambda being the parameter [math]\displaystyle{ \lambda }[/math] in the equation
[math]\displaystyle{ P(k;\lambda)=\frac{\lambda^k e^{-\lambda}}{k!} }[/math]
Or the Poisson probability mass distribution. [math]\displaystyle{ k }[/math] is an integer that could be in the matrix, and [math]\displaystyle{ P(k;\lambda) }[/math] is the probability that it is in the matrix.
Here is a sample of what it does:
octave:1> sample=poisson_rnd(4.793,10,12) sample = 5 3 5 3 7 6 2 4 6 5 10 8 8 4 10 6 3 8 6 4 3 2 6 7 3 5 4 3 4 1 1 2 3 2 4 4 4 7 5 6 10 5 6 7 4 4 7 3 5 9 2 8 6 3 2 3 2 7 3 5 5 6 5 2 5 1 7 6 6 9 2 4 4 3 1 3 6 4 2 1 9 2 3 8 5 3 5 4 0 3 2 6 3 6 0 6 10 5 5 3 7 4 4 0 7 6 2 4 2 6 6 2 3 3 7 6 6 7 2 7
plots
plot(sample) plots the columns of sample against the row index, which I guess could be useful later on, but not right now.