Mathematics Previous page   Next Page

Troubleshooting

Below is a list of typical problems and recommendations for dealing with them.

Problem
Recommendation
The solution found by fminbnd or fminsearch does not appear to be a global minimum.

There is no guarantee that you have a global minimum unless your problem is continuous and has only one minimum. Starting the optimization from a number of different starting points (or intervals in the case of fminbnd) may help to locate the global minimum or verify that there is only one minimum. Use different methods, where possible, to verify results.

Sometimes an optimization problem has values of x for which it is impossible to evaluate f.

Modify your function to include a penalty function to give a large positive value to f when infeasibility is encountered.

The minimization routine appears to enter an infinite loop or returns a solution that is not a minimum (or not a zero in the case of fzero).

Your objective function (fun) may be returning NaN or complex values. The optimization routines expect only real numbers to be returned. Any other values may cause unexpected results. To determine whether this is the case, set

  • options = optimset('FunValCheck', 'on')
    

and call the optimization function with options as an input argument. This displays a warning when the objective function returns NaN or complex values.


Previous page  Tips Numerical Integration (Quadrature) Next page

© 1994-2005 The MathWorks, Inc.