MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   【求助】如何产生01信号,其中1的概率是P (https://www.labfans.com/bbs/showthread.php?t=366)

totem 2007-06-10 13:58

【求助】如何产生01信号,其中1的概率是P
 
正在写课程论文,请高手指点,不胜感激:)

littlewolf 2007-06-12 09:39

比如0.25概率为0,0.75概率为1
 
A=double(rand(10)>=0.25)
A =

1 1 0 0 1 0 1 1 1 0
0 1 1 1 0 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1
1 1 0 1 1 1 1 1 1 0
1 0 0 1 1 0 1 1 0 1
1 1 0 1 1 1 1 1 1 1
1 1 0 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 1 1
1 1 1 0 1 1 1 1 1 0
1 1 0 1 0 1 1 1 1 1


所有时间均为北京时间。现在的时间是 12:35

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