Problem with "beta" functions & fmincon

13 views (last 30 days)
Reza-H
Reza-H on 2 Apr 2015
Commented: Torsten on 2 Apr 2015
A couple of years ago, I wrote extensive codes for some optimization problems using "fmincon". These codes were working fine using MATLAB 2011 but it is not working well with more recent version of MATLAB (2013a) e.g. when I do a Monte carlo experiment I used to get less than 5% non-converegence now I get more than 50%. The functions that I am optimizing involves "beta" and "betacdf" functions where the optimization is done with respect to the parameters. I have noticed that previously if you had negative parameters in these "beta" related functions you wouldn't get an error message and the optimization could continue and eventually converges to the positive values but now if there is a negative beta parameter value during the iterations of "fmincon", the optimization stops with an error message and this happens alot in my situation. Here is the kind of error message I keep getting now:
" Error using gammaln Input must be nonnegative.
Error in betaln (line 23) y = gammaln(z)+gammaln(w)-gammaln(z+w);
Error in beta (line 20) y = exp(betaln(z,w));_ "
Is there a way to get around this? If not, can I somehow have the earlier version of "beta" related functions with the new version of MATLAB or make some changes in MATLAB's "beta" functions to resolve the issue?
Thank you
  1 Comment
Torsten
Torsten on 2 Apr 2015
Replace the parameters to be optimized by their squares, i.e. z^2 instead of z etc.
Best wishes
Torsten.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!