question related to Statistics in matlab
조회 수: 3 (최근 30일)
이전 댓글 표시
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)
댓글 수: 0
답변 (1개)
Jeff Miller
2020년 5월 15일
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.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!