How can ı creat poisson random variables?
조회 수: 6 (최근 30일)
이전 댓글 표시
lambda = 75;
N = 0:200; %Number of people
P = poisspdf(N,lambda);
E=lambda;%expected value
V=lambda; %variance
bar(N,P,1);
xlabel('Observation');
ylabel('Probability');
I have a poisson distribution but I need to create poisson random numbers intead of N.CAn someone help me?
Thanks!
댓글 수: 0
채택된 답변
Akira Agata
2020년 5월 7일
lambda = 75;
r = poissrnd(lambda);
Or, if you want to generate 1000-by-1 random number array, you can do it by:
r = poissrnd(lambda,1000,1);
댓글 수: 3
Akira Agata
2020년 5월 7일
You mean, you want to create pdf plot from r ? Then, you can create it using histogram function with 'Normalization' option, like:
figure
histogram(r,'Normalization','pdf')
xlabel('Observation');
ylabel('Probability');
grid on
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291303/image.png)
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!