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
2013-2-26
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 Exchange 中查找有关 Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!