How to generate random number from Bernoulli distribution?
93 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
PARVATHY NAIR
le 19 Jan 2023
Réponse apportée : Bruno Luong
le 19 Jan 2023
just like the below command
a=randn(1,1000)
how can we generate random number from bernoulli distribution
0 commentaires
Réponse acceptée
Bruno Luong
le 19 Jan 2023
p = 0.25
X = double(rand(1,1000) < p)
histogram(X,'Normalization','pdf')
0 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!