15.11.2014 Views

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4 Function Functions<br />

Troubleshooting<br />

Here is a list <strong>of</strong> typical problems and recommendations for dealing with them.<br />

Problem<br />

The solution found by fminbnd<br />

or fminsearch does not appear<br />

to be a global minimum.<br />

Sometimes an optimization<br />

problem has values <strong>of</strong> x for<br />

which it is impossible to<br />

evaluate f.<br />

The minimization routine<br />

appears to enter an infinite loop<br />

or returns a solution that is not<br />

a minimum (or not a zero in the<br />

case <strong>of</strong> fzero).<br />

Recommendation<br />

There is no guarantee that you have a global minimum unless<br />

your problem is continuous and has only one minimum.<br />

Starting the optimization from a number <strong>of</strong> different starting<br />

points (or intervals in the case <strong>of</strong> fminbnd) may help to locate<br />

the global minimum or verify that there is only one minimum.<br />

Use different methods, where possible, to verify results.<br />

Modify your function to include a penalty function to give a<br />

large positive value to f when infeasibility is encountered.<br />

Your objective function (fun) may be returning NaN or complex<br />

values. The optimization routines expect only real numbers to<br />

be returned. Any other values may cause unexpected results.<br />

To determine whether this is the case, set<br />

options = optimset('FunValCheck', 'on')<br />

and call the optimization function with options as an input<br />

argument. This displays a warning when the objective<br />

function returns NaN or complex values.<br />

4-26

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!