MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   【求助】如何产生这样的随机数序列阿 (https://www.labfans.com/bbs/showthread.php?t=446)

shncoco 2007-06-25 00:18

【求助】如何产生这样的随机数序列阿
 
(1)产生一个长度为10000的随机序列x;
(2)画出该序列取值的统计直方图。该随机序列的取值集为 (1,2,3,4),取值概率如下:
x=1,p=0.4
x=2,p=0.3
x=3,p=0.2
x=4,p=0.1

我用X(k)=unidrnd(4,1,1000);产生取值为(1,2,3,4)的长度为1000的序列
下面就不知道怎么做了
如何能在知道概率分布的条件下产生随机序列 请大家帮忙!!!


所有时间均为北京时间。现在的时间是 05:10

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.