How to generate a Bernoulli distributed binary data
古いコメントを表示
Hi, I am trying to generate a Bernoulli distributed binary data. please help.
回答 (2 件)
Shashank Prasanna
2013 年 7 月 2 日
1 投票
You probably have an older version of MATLAB installed.
Try the following instead:
Check the output of 'ver' command to confirm you have the statistics toolbox.
If not there is always FEX:
Wayne King
2013 年 7 月 1 日
編集済み: Wayne King
2013 年 7 月 1 日
Do you have the Statistics Toolbox?
You have to specify the parameter for the distribution, which is the probability of a "success". Here I'll use p = 0.25
pd = makedist('Binomial','N',1,'p',0.25);
x = random(pd,100,1);
If you want the simple case where p = 0.5
x = randi([0 1],100,1);
カテゴリ
ヘルプ センター および File Exchange で Birnbaum-Saunders Distribution についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!