Creating a matrix with binomial distribution in elements.
Afficher commentaires plus anciens
How can I create a 6 × 6 matrix with P (Xi = j − 1) in the (i, j)-position where Xi has the binomial distribution with parameters n = i−1 and p = 1/4.
Réponses (1)
Massimo Zanetti
le 19 Oct 2016
0 votes
Check for "binornd" function in Matlab docs
2 commentaires
Shane Kosir
le 19 Oct 2016
Massimo Zanetti
le 19 Oct 2016
Modifié(e) : Massimo Zanetti
le 19 Oct 2016
So you don't need to extract a random number, instead you need to compute the probability. So, it is:
N=repmat((0:5)',1,6);
K=N';
P=1/4;
R = binopdf(K,N,P)
Notice that the triangular upper part is null, because there is 0 probability to get K successes if the numer of trials N is less than K....
Catégories
En savoir plus sur Binomial Distribution dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!