


% -*- texinfo -*-
% @deftypefn{Function File} {} fminunc (@var{fcn}, @var{x0}, @var{options})
% @deftypefnx{Function File} {[@var{x}, @var{fvec}, @var{info}, @var{output}, @var{fjac}]} = fminunc (@var{fcn}, @dots{})
% Solve a unconstrained optimization problem defined by the function @var{fcn}.
% @var{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 @var{x} such
% that @code{@var{fcn} (@var{x})} is a local minimum.
% @var{x0} determines a starting guess. The shape of @var{x0} is preserved
% in all calls to @var{fcn}, but otherwise it is treated as a column vector.
% @var{options} is a structure specifying additional options.
% Currently, @code{fminunc} recognizes these options:
% @code{'FunValCheck'}, @code{'OutputFcn'}, @code{'TolX'},
% @code{'TolFun'}, @code{'MaxIter'}, @code{'MaxFunEvals'},
% @code{'GradObj'}, @code{'FinDiffType'}.
%
% If @code{'GradObj'} is @code{'on'}, it specifies that @var{fcn},
% called with 2 output arguments, also returns the Jacobian matrix
% of right-hand sides at the requested point. @code{'TolX'} specifies
% the termination tolerance in the unknown variables, while
% @code{'TolFun'} is a tolerance for equations. Default is @code{1e-7}
% for both @code{'TolX'} and @code{'TolFun'}.
%
% For description of the other options, see @code{optimset}.
%
% On return, @var{fval} contains the value of the function @var{fcn}
% evaluated at @var{x}, and @var{info} may be one of the following values:
%
% @table @asis
% @item 1
% Converged to a solution point. Relative gradient error is less than specified
% by TolFun.
% @item 2
% Last relative step size was less that TolX.
% @item 3
% Last relative decrease in func value was less than TolF.
% @item 0
% Iteration limit exceeded.
% @item -3
% The trust region radius became excessively small.
% @end table
%
% Note: If you only have a single nonlinear equation of one variable, using
% @code{fminbnd} is usually a much better idea.
% @seealso{fminbnd, optimset}
% @end deftypefn