question related to Statistics in matlab

3 visualizaciones (últimos 30 días)
Zeynep Toprak
Zeynep Toprak el 14 de Mayo de 2020
Respondida: Jeff Miller el 15 de Mayo de 2020
I would like to write a matlab code by using this definition of poisson process
here, I want to simulate a poisson process, where n is chosen randomly between 1 and 10, lambda = 9 for 200 variates.
The codes that I wrote are totally wrong, so I cant post them, please give me a way or hint to do that. Thanks a lot.
My code is as follows:
n = randi ([1,10], 100);
t=1;
if P == (lambda * t)^n/factorial(n) * e(-lambda * t)
N = n
and
N_sum = cumsum(N);
disp(N_sum)

Respuestas (1)

Jeff Miller
Jeff Miller el 15 de Mayo de 2020
r=poissrnd(9,200,1);
will give you 200 random numbers from a poisson distribution with lambda=9. Lots of those numbers will be greater than 10, however, because those numbers occur frequently in that poisson distribution. If you really only want 200 numbers in the 1-10 range (some kind of truncated poisson, I guess), then generate maybe 400 and take the first 200 that are 10 or less.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by