Often it is useful to find the minimum value of a function rather than just
the zeroes where it crosses the x-axis.
fminbnd is designed for the
simpler, but very common, case of a univariate function where the interval
to search is bounded. For unbounded minimization of a function with
potentially many variables use
fminunc. See Optimization, for
minimization with the presence of constraint functions. Note that searches
can be made for maxima by simply inverting the objective function
Fto_max = -Fto_min).
Find a minimum point of a univariate function. fun should be a function handle or name. a, b specify a starting interval. options is a structure specifying additional options. Currently,
fminbndrecognizes these options:
"MaxFunEvals". For description of these options, see optimset.
On exit, the function returns x, the approximate minimum point and fval, the function value thereof. info is an exit flag that can have these values:
- 1 The algorithm converged to a solution.
- 0 Maximum number of iterations or function evaluations has been exhausted.
- -1 The algorithm has been terminated from user output function.
Solve an unconstrained optimization problem defined by the function fcn. fcn should accepts a vector (array) defining the unknown variables, and return the objective function value, optionally with gradient. In other words, this function attempts to determine a vector x such that fcn
)is a local minimum. x0 determines a starting guess. The shape of x0 is preserved in all calls to fcn, but otherwise is treated as a column vector. options is a structure specifying additional options. Currently,
fminuncrecognizes these options:
"on", it specifies that fcn, called with 2 output arguments, also returns the Jacobian matrix of right-hand sides at the requested point.
"TolX"specifies the termination tolerance in the unknown variables, while
"TolFun"is a tolerance for equations. Default is
For description of the other options, see
On return, fval contains the value of the function fcn evaluated at x, and info may be one of the following values:
- Converged to a solution point. Relative gradient error is less than specified by TolFun.
- Last relative step size was less that TolX.
- Last relative decrease in function value was less than TolF.
- Iteration limit exceeded.
- The trust region radius became excessively small.
Optionally, fminunc can also yield a structure with convergence statistics (output), the output gradient (grad) and approximate Hessian (hess).
Note: If you only have a single nonlinear equation of one variable, using
fminbndis usually a much better idea.