在给定概率下的随机数选择,其中附加概率选择低于某个值matlab

时间:2015-12-03 18:47:31

标签: matlab probability random-sample

我有以下问题,我无法解决如何解决它。 我必须连续14次从给定的可能性中随机抽取一个数字,但在每个循环中我都有一些拒绝某些值的可能性。

我必须从以下(x)

中抽取一个值
x=10:5:120;

......具有相应的概率(p):

p=[0.0795 0.0439 0.0694 0.0259 0.1325 0.0181 0.0753 0.1885 0.0753 0.0145 0.1145 0.0229 0.0247 0.0295 0.0289 0.0066 0.0307 0.0054 0.0030 0.0036 0 0 0];

但是每次(1:14)我都有不同的概率(p2)选择一定值(b):

b=[100 80 70 50 40 20 10]; p2=[0.9970,0.9970,0.9970,0.9822,0.9496,0.6291,0.0564;0.9970,0.9881,0.9881,0.9733,0.9080,0.5935,0.0504;0.9970,0.9970,0.9703,0.9377,0.8427,0.5460,0.0445;0.997,0.9733,0.9555,0.911,0.7478,0.4926,0.0356;0.997,0.9555,0.9377,0.8754,0.6647,0.4273,0.0326;0.997,0.9674,0.908,0.8101,0.5757,0.3561,0.0297;0.9970,0.9733,0.8843,0.7864,0.5134,0.3056,0.0267;0.997,0.9496,0.8813,0.7596,0.4777,0.273,0.0267;0.997,0.9614,0.8783,0.7478,0.4481,0.2493,0.0237;0.997,0.9674,0.8754,0.7359,0.4273,0.2255,0.0208;0.997,0.9763,0.8843,0.73,0.4095,0.2107,0.0208;0.997,0.9792,0.8724,0.7211,0.3947,0.2018,0.0208;0.997,0.9763,0.8694,0.7181,0.3858,0.1958,0.0237;0.997,0.9525,0.8694,0.7151,0.3739,0.1869,0.0267;];

举个例子:在第4次重复中,我必须从矩阵x中选择一个数字,从矩阵p给出概率,我得到0.9970概率选择一个数字低于100,0.9733选择低于80, 0.9555低于70,0.9110低于50,......等

如果您需要任何澄清,请随时发表评论! 非常感谢你提前!

0 个答案:

没有答案