MATLAB Answers

0

poissrnd function issue: weird histogram

Asked by Saurabh Talele on 21 Sep 2017
Latest activity Edited by Saurabh Talele on 22 Sep 2017
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)

  0 Comments

Sign in to comment.

1 Answer

Answer by José-Luis
on 21 Sep 2017
Edited by José-Luis
on 21 Sep 2017

The loop is unnecessary:
histogram(poissrnd(100,1e6,1),300)
Works as expected.

  1 Comment

Thanks a lot :) however, i am still curious about what happens in the stated case.

Sign in to comment.