error in betarnd function
Show older comments
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.
Answers (1)
Shashank Prasanna
on 26 Feb 2013
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);
Categories
Find more on Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!