FMINSEARCH Multidimensional unconstrained nonlinear minimization (Nelder-Mead).
X = FMINSEARCH(FUN,X0) starts at X0 and finds a local minimizer X of the
function FUN. FUN accepts input X and returns a scalar function value
F evaluated at X. X0 can be a scalar, vector or matrix.
X = FMINSEARCH(FUN,X0,OPTIONS) minimizes with the default optimization
parameters replaced by values in the structure OPTIONS, created
with the OPTIMSET function. See OPTIMSET for details. FMINSEARCH uses
these options: Display, TolX, TolFun, MaxFunEvals, and MaxIter.
X = FMINSEARCH(FUN,X0,OPTIONS,P1,P2,...) provides for additional
arguments which are passed to the objective function, F=feval(FUN,X,P1,P2,...).
Pass an empty matrix for OPTIONS to use the default values.
(Use OPTIONS = [] as a place holder if no options are set.)
[X,FVAL]= FMINSEARCH(...) returns the value of the objective function,
described in FUN, at X.
[X,FVAL,EXITFLAG] = FMINSEARCH(...) returns a string EXITFLAG that
describes the exit condition of FMINSEARCH.
If EXITFLAG is:
1 then FMINSEARCH converged with a solution X.
0 then the maximum number of iterations was reached.
[X,FVAL,EXITFLAG,OUTPUT] = FMINSEARCH(...) returns a structure
OUTPUT with the number of iterations taken in OUTPUT.iterations.
Examples
FUN can be specified using @:
X = fminsearch(@sin,3)
finds a minimum of the SIN function near 3.
In this case, SIN is a function that returns a scalar function value
SIN evaluated at X.
FUN can also be an inline object:
X = fminsearch(inline('norm(x)'),[1;2;3])
returns a minimum near [0;0;0].
FMINSEARCH uses the Nelder-Mead simplex (direct search) method.
See also OPTIMSET, FMINBND, @, INLINE.