# question related to Statistics in matlab

5 views (last 30 days)
Zeynep Toprak on 14 May 2020
Answered: Jeff Miller on 15 May 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)

Jeff Miller on 15 May 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.