Generate Random Poisson Distrubution and Plotting.

조회 수: 2 (최근 30일)
vahap yigit
vahap yigit 2017년 4월 20일
답변: Torsten 2017년 4월 21일
Hi, I want to create a poisson distrubition with generating random numbers. I find some code in this site and make some modify
-------------------------------------------------------------
function S = PoissonSamp3(lambda,ns);
% -------------------------------------------------------------
S = zeros(ns,1);
for i = 1:ns
k = 0;
produ = rand;
while produ >= exp(-lambda)
produ = produ*rand;
k = k+1;
end
S(i) = k;
end
plot(S)
But this plotting like that;
In the internet I found that poisson distrubition should like that
So does anyone can some help me. Thak You

답변 (1개)

Torsten
Torsten 2017년 4월 21일
https://de.mathworks.com/help/stats/poissrnd.html
Best wishes
Torsten.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by