error in betarnd function

I am using betarnd to generate beta distributed samples. However, sometimes the following error occurs.
" ??? Error using ==> binornd at 31 Size information is inconsistent.
Error in ==> betarnd at 44 r(t) = binornd(1,p,sum(t(:)),1); "
For example, using this line of code would sometimes produce the above error: betarnd([0.0001 0.0001 1],[0.0001 0.0001 1]).
Should line 44 of betarnd.m be "r(t) = binornd(1,p,1,sum(t(:)));" instead of "r(t) = binornd(1,p,sum(t(:)),1);"?
Thanks for your help.

回答 (1 件)

Shashank Prasanna
Shashank Prasanna 2013 年 2 月 26 日

0 投票

This is indeed a bug in betarnd which existed in releases prior to MATLAB R2011a.
If you are using an older release you are right about the fix as well.
>> edit betarnd
and replace Line 44 with
>> r(t) = binornd(1,p(:),sum(t(:)),1);

カテゴリ

ヘルプ センター および File ExchangeSignal Processing についてさらに検索

タグ

質問済み:

Jun
2013 年 2 月 26 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by