Mathematics |
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
You can ask for a tabular display of output by passing a fourth argument created by the optimset
command to fminbnd
Func-count x f(x) Procedure 3 0.567376 12.9098 initial 4 0.732624 13.7746 golden 5 0.465248 25.1714 golden 6 0.644416 11.2693 parabolic 7 0.6413 11.2583 parabolic 8 0.637618 11.2529 parabolic 9 0.636985 11.2528 parabolic 10 0.637019 11.2528 parabolic 11 0.637052 11.2528 parabolic Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 1.000000e-004 x = 0.6370
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.
Minimizing Functions and Finding Zeros | Minimizing Functions of Several Variables |
© 1994-2005 The MathWorks, Inc.