필터 지우기
필터 지우기

Matlab poisson random numbers

조회 수: 2 (최근 30일)
athpapa -
athpapa - 2011년 3월 11일
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
Walter Roberson 2011년 3월 11일
That wouldn't be a poisson distribution anymore. The bulk of the probability is concentrated near the mean.

Matt Tearle
Matt Tearle 2011년 3월 11일
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.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by