poissrnd function issue: weird histogram

2 次查看(过去 30 天)
I tried to produce 10^6 poisson distributed random numbers and when i looked at the histogram, it had either some gaps or shoots depending upon the bin size... can anyone exlpain whats happening here?
t = zeros(1000000,1);
for i = 1:1000000
t(i,1) = poissrnd(100);
end
hist(t,300)

回答(1 个)

José-Luis
José-Luis 2017-9-21
编辑:José-Luis 2017-9-21
The loop is unnecessary:
histogram(poissrnd(100,1e6,1),300)
Works as expected.
  1 个评论
Saurabh Talele
Saurabh Talele 2017-9-22
编辑:Saurabh Talele 2017-9-22
Thanks a lot :) however, i am still curious about what happens in the stated case.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by