MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何生成在此范围内的随机数? [重复] (https://www.labfans.com/bbs/showthread.php?t=22497)

poster 2019-12-07 15:22

如何生成在此范围内的随机数? [重复]
 
这个问题已经在这里有了答案:

[LIST][*] [URL="https://www.labfans.com/questions/13914066/generate-random-number-with-given-probability-matlab"]用给定的概率生成随机数matlab[/URL] 5 answers[*] [URL="https://www.labfans.com/questions/58607156/draw-random-numbers-from-pre-specified-probability-mass-function-in-matlab"]从Matlab中预先指定的概率质量函数中提取随机数[/URL] 1答案[/LIST]
我想生成一些随机数,用于这种分布:

[LIST][*]其中10%位于A类(T = 6),[*]其中40%位于B类(T = 8),[*]其中40%位于C类(T = 10),[*]其中10%位于D类(T = 12)。[/LIST]我刚开始学习MATLAB,尝试过rand(x)和randn(x)但似乎他们俩都做不到?



[url=https://stackoverflow.com/q/58723874]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:33

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