matlab2012a vs matlab20111b. Why does the latter produces an error message?

2 views (last 30 days)
Dear all,
I use matlab 2012a and matlab 2011b
I have constructed a code and whenever I run it in matlab 2012a everything runs normal Yet, whenever I run it in matlab2011b I obtain the following error which is related to the fminunc function
??? Error using ==> roots at 28
Input to ROOTS must not contain NaN or
Error in ==>
at 304
stationaryPoint = roots([3*coeff(1)
2*coeff(2) coeff(3)]);
Error in ==>
lineSearch>pickAlphaWithinInterval at 279
z =
Error in ==> lineSearch>sectioningPhase at
alpha =
Error in ==> lineSearch at 55
= sectioningPhase(funfcn, ...
Error in ==> fminusub at 208
= ...
Error in ==> fminunc at 376
fminusub(funfcn,x, ...
Error in ==> testxa2 at 252
Why is this happening? Do I neeed to update this function within matlab2011b?

Accepted Answer

Seth DeLand
Seth DeLand on 22 Aug 2012
I think the cause here is that fminunc was updated in R2012a to attempt to recover when the objective function returns NaN or Inf:
My guess is that at some point your objective function 'CES_mode7cutDCsvk' is returning a value of Inf or NaN. In 12a fminunc attempts to recover from this, but in 11b it just causes an error.
If you need to use 11b, check out this thread for some things you could try:
Of course, if you can use 12a that would be best since the solver has been enhanced.

More Answers (0)


Find more on Argument Definitions 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!