Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
how to represent my outcomes from a multinomial distribution in terms of y=1:10
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clc
clear all
format compact
rng(970,'v4')
X=[];
X1=[];
X2=[];
X3=[];
U=[];
p =[0.0080 0.0270 0.1250 0.0360 0.0600 0.1350 0.2250 0.0540 0.1500 0.1800];
Y=1:10;
for i = (1:10000)
r =rand;
if r<0 & r<=0.0080
x1=0; x2=0; x3=3;
Y=1;
X1=[x1];X2=[x2];X3=[x3];
U=[U,r];
else if r>0.0080 & r<=0.0350
x1=0; x2=3; x3=0;
Y=2;
X1=[x1];X2=[x2];X3=[x3];
U=[U,r];
else if r>0.0350 & r<=0.1600
x1=3; x2=0; x3=0;
Y=3;
X1=[x1];X2=[x2];X3=[x3];
U=[U,r];
else if r>0.1600 & r<=0.1960
x1=0; x2=1; x3=2;
Y=4;
X1=[x1];X2=[x2];X3=[x3];
U=[U,r];
else if r>0.1960 & r<=0.2560
x1=1; x2=0; x3=2;
Y=5;
X1=[x1];X2=[x2];X3=[x3];
U=[U,r];
else if r>0.2560 & r<=0.3910
x1=1; x2=2; x3=0;
Y=6;
X1=[x1];X2=[x2];X3=[x3];
U=[U,r];
else if r>0.3910 & r<=0.6160
x1=2; x2=1; x3=0;
Y=7;
X1=[x1];X2=[x2];X=[x3];
U=[U,r];
else if r>0.6160 & r<=0.6700
x1=0; x2=2; x3=1;
Y=8;
X1=[x1];X2=[x2],X3=[x3];
U=[U,r];
else if r>0.6700 & r<=0.8200
x1=2; x2=0; x3=1;
Y=9;
X1=[x1];X2=[x2],X3=[x3];
U=[U,r];
else if r>0.8200 & r<=1
x1=1; x2=1; x3=1;
Y=10;
X1=[x1];X2=[x2];X3=[x3];
U=[U,r];
end
end
end
end
end
end
end
end
end
end
end
0 commentaires
Réponses (0)
Cette question est clôturée.
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!