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.

Respuestas (1)

Shashank Prasanna
Shashank Prasanna el 26 de Feb. de 2013

0 votos

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);

Categorías

Más información sobre Signal Processing en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

Jun
el 26 de Feb. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by