Mathematics Previous page   Next Page

Minimizing Functions of One Variable

Given a mathematical function of a single variable coded in an M-file, you can use the fminbnd function to find a local minimizer of the function in a given interval. For example, to find a minimum of the humps function in the range (0.3, 1), use

which returns

You can ask for a tabular display of output by passing a fourth argument created by the optimset command to fminbnd

which gives the output

This shows the current value of x and the function value at f(x) each time a function evaluation occurs. For fminbnd, one function evaluation corresponds to one iteration of the algorithm. The last column shows what procedure is being used at each iteration, either a golden section search or a parabolic interpolation.

Previous page  Minimizing Functions and Finding Zeros Minimizing Functions of Several Variables Next page

© 1994-2005 The MathWorks, Inc.