How to generate random number from Bernoulli distribution?
조회 수: 73 (최근 30일)
이전 댓글 표시
just like the below command
a=randn(1,1000)
how can we generate random number from bernoulli distribution
댓글 수: 0
채택된 답변
Bruno Luong
2023년 1월 19일
p = 0.25
X = double(rand(1,1000) < p)
histogram(X,'Normalization','pdf')
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!