Matlab poisson random numbers
이전 댓글 표시
Hello,
I use in my code the Matlab function 'poissrnd' to produce random numbers, for example: A=poissrnd(100,1,20) to produce 20 random numbers!But some times the poissrnd function returns 2 or more same values e.g. 20,20. Is there any way the 'poissrnd' function to produce total different numbers each time I run it?
Thank you!
답변 (2개)
Walter Roberson
2011년 3월 11일
0 개 추천
That wouldn't be a poisson distribution anymore. The bulk of the probability is concentrated near the mean.
Matt Tearle
2011년 3월 11일
0 개 추천
Any discrete distribution has a nonzero probability of producing repeats. If you don't want repeats then you're not sampling from a distribution, you're just permuting a set of values. For that, you can use randperm.
So the real question is what are you trying to achieve and why? I suppose you might want a random permutation, or portion thereof, that's weighted so that certain values are more likely to appear at the beginning of the sequence. In which case, you'll have to program that manually with a while loop. The ismember function could be useful.
카테고리
도움말 센터 및 File Exchange에서 Poisson Distribution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!