MATLAB Answers

poissrnd function issue: weird histogram

조회 수: 1(최근 30일)
Saurabh Talele
Saurabh Talele 21 Sep 2017
편집: Saurabh Talele 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

로그인 to comment.

답변(1개)

José-Luis
José-Luis 21 Sep 2017
편집: José-Luis 21 Sep 2017
The loop is unnecessary:
histogram(poissrnd(100,1e6,1),300)
Works as expected.

  댓글 수: 1

Saurabh Talele
Saurabh Talele 22 Sep 2017
Thanks a lot :) however, i am still curious about what happens in the stated case.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by