function opt_con

% OPT_CON Show the help for the functions in this toolbox.

% This file is automatically generated.  Matthew Simoneau, 09-04-98
% Copyright (c) 1984-98 by The MathWorks, Inc. All Rights Reserved
% $Revision: 1.12 $ $Date: 1998/10/16 23:19:34 $

helpwin('opt_con/Contents');

function Contents
%MATLAB Tour Partial Function Help:  opt_con
%
%Double click on any function for more information
%
%  Optimization Toolbox. 
%  Version 2.0 (R11) 09-Oct-1998
% 
%  What's new.
%    Readme     - New features, bug fixes, and changes in this version.
% 
%  Nonlinear minimization of functions.
%    fminbnd     - Scalar bounded nonlinear function minimization.
%    fmincon     - Multidimensional constrained nonlinear minimization.
%    fminsearch  - Multidimensional unconstrained nonlinear minimization, 
%                   by Nelder-Mead direct search method.
%    fminunc     - Multidimensional unconstrained nonlinear minimization.
%    fseminf     - Multidimensional constrained minimization, semi-infinite 
%                   constraints.
% 
%  Nonlinear minimization of multi-objective functions.
%    fgoalattain - Multidimensional goal attainment optimization 
%    fminimax    - Multidimensional minimax optimization.
%         
%  Linear least squares (of matrix problems).
%    lsqlin      - Linear least squares with linear constraints.
%    lsqnonneg   - Linear least squares with nonnegativity constraints.
% 
%  Nonlinear least squares (of functions).
%    lsqcurvefit - Nonlinear curvefitting via least squares (with bounds).
%    lsqnonlin   - Nonlinear least squares with upper and lower bounds.
% 
%  Nonlinear zero finding (equation solving).
%    fzero       - Scalar nonlinear zero finding.
%    fsolve      - Nonlinear system of equations solve (function solve).
% 
%  Minimization of matrix problems.
%    linprog    - Linear programming.
%    quadprog   - Quadratic programming.
%  
%  Controlling defaults and options.
%    optimset - Create or alter optimization OPTIONS structure. 
%    optimget - Get optimization parameters from OPTIONS structure. 
% 
%  Demonstrations of large-scale methods.
%    circustent - Quadratic programming to find shape of a circus tent.
%    molecule   - Molecule conformation solution using unconstrained nonlinear
%                 minimization.
%    optdeblur  - Image deblurring using bounded linear least-squares.
% 
%  Demonstrations of medium-scale methods.
%    optdemo    - Demonstration menu.
%    tutdemo    - Tutorial walk-through.
%    bandemo    - Minimization of banana function.
%    goaldemo   - Goal attainment.
%    dfildemo   - Finite-precision filter design (requires Signal Processing
%                 Toolbox).
%    datdemo    - Fitting data to a curve.
%

function Readme
%MATLAB Tour Partial Function Help:  opt_con
%
%  Release Notes, Optimization Toolbox.
%  Version 2.0 (R11)    09-Oct-1998
% 
%  The README FILE
%  This file contains a list of bug fixes, enhancements, and new features.  
%  Use HELP on any of these files for more information.
% 
%  DIFFERENCES BETWEEN VERSION 2.0 AND VERSION 1.5
%  
%  Topics include:
% 
%  - general enhancements
%  - enhancements to specific functions
%  - new functions
%  - compatibility issues
% 
%  GENERAL ENHANCEMENTS 
% 
%  This section summarizes general areas of enhancement to the toolbox. See
%  the Optimization Toolbox User's Guide for more information about these
%  enhancements.
% 
%  Support for large-sparse problems
%    New large-scale (sparse) algorithms have been incorporated into some
%    of the toolbox functions, including support for linear programming and
%    nonlinear functions.  See the NEW FUNCTIONS section below for details
%    on what specific problems are supported.
% 
%  Nonlinear least-squares with bound constraints
%    Bounds on the parameters for nonlinear least-squares and curvefitting
%    problems can be specified. See LSQNONLIN and LSQCURVEFIT in the NEW
%    FUNCTIONS section below.
%  
%  Command line syntax 
%    The input and output arguments for the new functions have been
%    expanded to improve usability and numerical efficiency.  For example,
%    nonlinear and linear constraints are specified separately. Also
%    equality constraints and inequality constraints are specified
%    separately.  The gradient of the objective is now computed
%    in the same function as the objective; likewise the gradient
%    of the nonlinear constraints is computed in the same function as the
%    nonlinear constraints.  More output information is available
%    including an exit flag that denotes the termination state.
% 
%  Options structure
%    The options array has been updated to an options structure. The
%    fields for the structure are changed or accessed using the OPTIMSET
%    and OPTIMGET functions.
% 
%  Diagnostic output
%    Diagnostic output may be requested at the beginning of an
%    optimization routine. The information printed to the screen includes
%    the number of linear and nonlinear functions, the number of equality 
%    and inequality constraints, the number of upper and lower bounds, and
%    the objective and constraint functions used.  See OPTIMSET and the
%    'Diagnostics' OPTIONS parameter.
% 
%  ENHANCED FUNCTIONS FOR 2.0
%    fzero       - Calling sequence updated to match other new functions.
%    fsolve      - Nonlinear system of equations solve (function solve)
%                  (now includes support for large-scale optimization).
% 
%  NEW FUNCTIONS FOR 2.0
%    fminbnd     - Scalar bounded nonlinear function minimization
%                  (was fmin).
%    fmincon     - Multidimensional constrained nonlinear minimization
%                  (was constr, plus includes support for large-scale optimization 
%                  when only linear equalities or only bound constraints and gradient
%                  information is provided).
%    fminsearch  - Multidimensional unconstrained nonlinear minimization, 
%                  by Nelder-Mead direct search method.
%                  (was fmins).
%    fminunc     - Multidimensional unconstrained nonlinear minimization
%                  (was fminu, plus includes support for large-scale optimization
%                   when gradient information is provided).
%    fseminf     - Multidimensional constrained minimization, semi-infinite 
%                  constraints (was seminf).
%    lsqcurvefit - Nonlinear curvefitting via least squares.
%                  (was curvefit, plus includes support for large-scale optimization
%                  and allows bound constraints on the variables).
%    lsqlin      - Linear least squares with linear constraints
%                  (was conls, plus includes support for large-scale optimization
%                  when only bound constraints).
%    lsqnonlin   - Nonlinear least squares with upper and lower bounds.
%                  (was leastsq, plus includes support for large-scale optimization
%                  and allows bound constraints on the variables).
%    lsqnonneg   - Linear least squares with nonnegativity constraints
%                  (was nnls).
%    linprog    -  Linear programming
%                  (was lp, plus includes support for large-scale optimization).
%    quadprog   -  Quadratic programming
%                  (was qp, plus includes support for large-scale optimization
%                  when only linear equalities or only bound constraints).
%    optimset - Create or alter optimization OPTIONS structure. 
%    optimget - Get optimization parameters from OPTIONS structure.    
% 
%  Use HELP on these files or TYPE them for more information.
% 
%  COMPATIBILITY ISSUES
%    Most of the optimization functions have changed names except for
%    FZERO and FSOLVE.  Except for FZERO and FSOLVE, the old function
%    names have been temporarily grandfathered, meaning that for now they
%    are still available in the toolbox and the code for these functions is
%    exactly the same as in version 1.5.2 of the toolbox.  These
%    grandfathered functions will be removed in a later release.  Users
%    are encouraged to migrate to the new functions.
% 
%    For FZERO and FSOLVE, some attempt is made to see if the new or old syntax
%    of the function is being used.  If the syntax is ambiguous, a warning
%    is given and the new code is used. 
%  

function fminbnd
%MATLAB Tour Partial Function Help:  opt_con
%
% FMINBND Scalar bounded nonlinear function minimization.  
%    X = FMINBND(FUN,x1,x2) returns a value X that is a local minimizer
%    of the function that is described in FUN (usually an M-file)
%    in the interval x1 < X < x2. The function FUN should return a scalar 
%    function value F when called with feval: F=feval(FUN,X). 
%    See below for more options for FUN.
% 
%    X = FMINBND(FUN,x1,x2,OPTIONS) minimizes with the default optimization
%    parameters replaced by values in the structure OPTIONS, created with
%    the OPTIMSET function.  See OPTIMSET for details.  FMINBND uses these options: 
%    Display, TolX, MaxFunEval and MaxIter. 
% 
%    X = FMINBND(FUN,x1,x2,OPTIONS,P1,P2,...) provides for additional
%    arguments, which are passed to the objective function, FUN(X,P1,P2,...).
%    (Use OPTIONS = [] as a place holder if no options are set.)
% 
%    [X,FVAL] = FMINBND(...) also returns the value of the objective function,
%    FVAL, computed in FUN, at X.
% 
%    [X,FVAL,EXITFLAG] = FMINBND(...) also returns a string EXITFLAG that 
%    describes the exit condition of FMINBND.  
%    If EXITFLAG is:
%      1 then FMINBND converged with a solution X based on OPTIONS.TolFun
%      0 then the maximum number of function evaluations was reached
%    
%    [X,FVAL,EXITFLAG,OUTPUT] = FMINBND(...) also returns a structure
%    OUTPUT with the number of iterations taken in OUTPUT.iterations.
% 
%    Examples
%        x = fminbnd('cos',3,4) computes pi to a few decimal places 
%          and gives a message upon termination.
%        [x,fval,exitflag] = fminbnd('cos',3,4,optimset('TolX',1e-12,'Display','off')) 
%          computes pi to about 12 decimal places, suppresses output, returns the  
%          function value at x, and returns an exitflag of 1.
%    
%    The argument FUN can be an inline function:
%       f = inline('sin(x)+3');
%       x = fminbnd(f,2,5);
%    Or create an M-file function afun.m on your path that contains
%      function f = afun(x)
%        f = sin(x) = 3;
%    then call fminbnd
%      x = fminbnd('afun',2,5);
%      
% 
%    

function fmincon
%MATLAB Tour Partial Function Help:  opt_con
%
% FMINCON Finds the constrained minimum of a function of several variables.
%    FMINCON solves problems of the form:
%        min F(X)  subject to:  A*X  <= B, Aeq*X  = Beq (linear constraints)
%         X                       C(X) <= 0, Ceq(X) = 0   (nonlinear constraints)
%                                 LB <= X <= UB            
%                                                            
%    X=FMINCON(FUN,X0,A,B) starts at X0 and finds a minimum X to the function
%    described in FUN, subject to the linear inequalities A*X <= B. X0 may be a 
%    scalar, vector or matrix. The function FUN (usually an M-file or inline object) 
%    should return a scalar function value F evaluated at X when called with 
%    feval: F=feval(FUN,X).
% 
%    X=FMINCON(FUN,X0,A,B,Aeq,Beq) minimizes FUN subject to the linear equalities
%    Aeq*X = Beq as well as A*X <= B. (Set A=[] and B=[] if no inequalities exist.)
% 
%    X=FMINCON(FUN,X0,A,B,Aeq,Beq,LB,UB) defines a set of lower and upper
%    bounds on the design variables, X, so that the solution is always in 
%    the range LB <= X <= UB. (Set Aeq=[] and Beq=[] if no equalities exist.)
% 
%    X=FMINCON(FUN,X0,A,B,Aeq,Beq,LB,UB,NONLCON) subjects the minimization to the 
%    constraints defined in NONLCON. The function NONLCON should return the vectors
%    C and Ceq, representing the nonlinear inequalities and equalities respectively, 
%    when called with feval: [C, Ceq] = feval(NONLCON,X). FMINCON minimizes
%    FUN such that C(X)<=0 and Ceq(X)=0. (Set LB=[] and/or UB=[] if no bounds exist.)
% 
%    X=FMINCON(FUN,X0,A,B,Aeq,Beq,LB,UB,NONLCON,OPTIONS) minimizes with the 
%    default optimization parameters replaced by values in the structure OPTIONS, 
%    an argument created with the OPTIMSET function.  See OPTIMSET for details.  Used
%    options are Display, TolX, TolFun, TolCon, DerivativeCheck, Diagnostics, GradObj, 
%    GradConstr, Hessian, MaxFunEvals, MaxIter, DiffMinChange and DiffMaxChange, 
%    LargeScale, MaxPCGIter, PrecondBandWidth, TolPCG, TypicalX, HessPattern. 
%    Use the GradObj option to specify that FUN may be called with two output 
%    arguments where the second, G, is the partial derivatives of the
%    function df/dX, at the point X: [F,G] = feval(FUN,X). Use the GradConstr
%    option to specify that NONLCON may be called with four output arguments:
%    [C,Ceq,GC,GCeq] = feval(NONLCON,X) where GC is the partial derivatives of the 
%    constraint vector of inequalities C an GCeq is the partial derivatives of the 
%    constraint vector of equalities Ceq. Use OPTIONS = [] as a place holder if 
%    no options are set.
%   
%    X=FMINCON(FUN,X0,A,B,Aeq,Beq,LB,UB,NONLCON,OPTIONS,P1,P2,...) passes the 
%    problem-dependent parameters P1,P2,... directly to the functions FUN 
%    and NONLCON: feval(FUN,X,P1,P2,...) and feval(NONLCON,X,P1,P2,...).  Pass
%    empty matrices for A, B, Aeq, Beq, OPTIONS, LB, UB, and NONLCON to use the 
%    default values.
% 
%    [X,FVAL]=FMINCON(FUN,X0,...) returns the value of the objective 
%    function FUN at the solution X.
% 
%    [X,FVAL,EXITFLAG]=FMINCON(FUN,X0,...) returns a string EXITFLAG that 
%    describes the exit condition of FMINCON.  
%    If EXITFLAG is:
%       1 then FMINCON converged to a solution X.
%       0 then the maximum number of function evaluations was reached.
%      -1 then FMINCON did not converge to a solution.
%    
%    [X,FVAL,EXITFLAG,OUTPUT]=FMINCON(FUN,X0,...) returns a structure
%    OUTPUT with the number of iterations taken in OUTPUT.iterations, the number
%    of function evaluations in OUTPUT.funcCount, the algorithm used in OUTPUT.algorithm,
%    the number of CG iterations in OUTPUT.cgiterations, and the first-order optimality
%    in OUTPUT.firstorderopt.
% 
%    [X,FVAL,EXITFLAG,OUTPUT,LAMBDA]=FMINCON(FUN,X0,...) returns the Lagrange multipliers
%    at the solution X: LAMBDA.lower for LB, LAMBDA.upper for UB, LAMBDA.ineqlin is
%    for the linear inequalities, LAMBDA.eqlin is for the linear equalities,
%    LAMBDA.ineqnonlin is for the nonlinear inequalities, and LAMBDA.eqnonlin
%    is for the nonlinear equalities.
% 
%    [X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD]=FMINCON(FUN,X0,...) returns the value of 
%    the gradient of FUN at the solution X.
% 
%    [X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN]=FMINCON(FUN,X0,...) returns the 
%    value of the HESSIAN of FUN at the solution X.
% 
%    

function fminsearch
%MATLAB Tour Partial Function Help:  opt_con
%
% FMINSEARCH Multidimensional unconstrained nonlinear minimization (Nelder-Mead).
%    X = FMINSEARCH(FUN,X0) returns a vector X that is a local
%    minimizer of the function that is described in FUN (usually an M-file: FUN.M)
%    near the starting vector X0.  FUN should return a scalar function value when 
%    called with feval: F=feval(FUN,X).  See below for more options for FUN.
% 
%    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.
% 
%    The argument FUN can be an inline function:
%       f = inline('norm(x)');
%       x = fminsearch(f,[1;2;3]);
% 
%    FMINSEARCH uses the Nelder-Mead simplex (direct search) method.
% 
%    

function fminunc
%MATLAB Tour Partial Function Help:  opt_con
%
% FMINUNC  Finds the minimum of a function of several variables.
%    X=FMINUNC(FUN,X0) starts at the point X0 and finds a minimum X of the
%    function described in FUN. X0 can be a scalar, vector or matrix.
%    The function FUN (usually an M-file or inline object) should return a scalar 
%    function value F evaluated at X when called with feval: F=feval(FUN,X). 
%    See the examples below for more about FUN.
% 
%    X=FMINUNC(FUN,X0,OPTIONS)  minimizes with the default optimization
%    parameters replaced by values in the structure OPTIONS, an argument
%    created with the OPTIMSET function.  See OPTIMSET for details.  Used
%    options are Display, TolX, TolFun, DerivativeCheck, Diagnostics, GradObj,
%    HessPattern, LineSearchType, Hessian, HessUpdate, MaxFunEvals, MaxIter, DiffMinChange 
%    and DiffMaxChange, LargeScale, MaxPCGIter, PrecondBandWidth, TolPCG, TypicalX. 
%    Use the GradObj option to specify that FUN can be called with two output 
%    arguments where the second, G, is the partial derivatives of the
%    function df/dX, at the point X: [F,G] = feval(FUN,X).  Use Hessian
%    to specify that FUN can be called with three output arguments where the 
%    second, G, is the partial derivatives of the function df/dX, and the third H
%    is the 2nd partial derivatives of the function (the Hessian) at the 
%    point X: [F,G,H] = feval(FUN,X).  The Hessian is only used by the large-scale
%    method, not the line-search method. 
% 
%    X=FMINUNC(FUN,X0,OPTIONS,P1,P2,...) passes the problem-dependent 
%    parameters P1,P2,... directly to the function FUN, e.g. FUN would be
%    called using feval as in: feval(FUN,X,P1,P2,...).  
%    Pass an empty matrix for OPTIONS to use the default values.
% 
%    [X,FVAL]=FMINUNC(FUN,X0,...) returns the value of the objective 
%    function FUN at the solution X.
% 
%    [X,FVAL,EXITFLAG]=FMINUNC(FUN,X0,...) returns a string EXITFLAG that 
%    describes the exit condition of FMINUNC.  
%    If EXITFLAG is:
%       > 0 then FMINUNC converged to a solution X.
%       ==0 then the maximum number of function evaluations was reached.
%       < 0 then FMINUNC did not converge to a solution.
%    
%    [X,FVAL,EXITFLAG,OUTPUT]=FMINUNC(FUN,X0,...) returns a structure OUTPUT
%    with the number of iterations taken in OUTPUT.iterations, the number of
%    function evaluations in OUTPUT.funcCount, the algorithm used in OUTPUT.algorithm,
%    the number of CG iterations in OUTPUT.cgiterations, and the first-order 
%    optimality in OUTPUT.firstorderopt.
% 
%    [X,FVAL,EXITFLAG,OUTPUT,GRAD]=FMINUNC(FUN,X0,...) returns the value 
%    of the gradient of FUN at the solution X.
% 
%    [X,FVAL,EXITFLAG,OUTPUT,GRAD,HESSIAN]=FMINUNC(FUN,X0,...) returns the 
%    value of the Hessian of the objective function FUN at the solution X.
% 
%    Examples 
%    Minimize the one dimensional function f(x) = sin(x) + 3:
%      To use an M-file, i.e. FUN = 'myfun', create a file myfun.m: 
%         function f = myfun(x)
%          f = sin(x)+3;
%      Then call FMINUNC to find a minimum of FUN near 2:
%         x = fminunc('myfun',2)
%      To minimize this function with the gradient provided, modify
%      the m-file myfun.m so the gradient is the second output argument:
%         function [f,g]= myfun(x)
%          f = sin(x) + 3;
%          g = cos(x);
%      and indicate the gradient value is available by creating an options
%      structure with OPTIONS.GradObj set to 'on' (using OPTIMSET):
%         options = optimset('GradObj','on');
%         x = fminunc('myfun',2,options);
% 
%      To minimize the function f(x) = sin(x) + 3 using an inline object:
%         f = inline('sin(x)+3');
%         x = fminunc(f,2);
%      To use inline objects for the function and gradient, FUN is a cell array of two 
%      inline objects where the first is the objective and the second is the
%      gradient of the objective:
%         options = optimset('GradObj','on');
%         x = fminunc({ inline('sin(x)+3'), inline('cos(x)') } ,2,options);
% 

function fseminf
%MATLAB Tour Partial Function Help:  opt_con
%
% FSEMINF Solves semi-infinite constrained optimization problems.
%    FSEMINF solves problems of the form:
% 
%           min { F(x) | C(x)<=0 , Ceq(X) = 0 , PHI(x,w)<=0 }
%             x
%    for all w in an interval. 
% 
%    X=FSEMINF(FUN,X0,NTHETA,SEMINFCON) starts at X0 and finds minimum X to the function
%    FUN constrained by NTHETA semi-infinite constraints in SEMINFCON (usually an 
%    M-file). FUN should return a scalar value of the function to be minimized when
%    called with feval, F = feval(FUN,X). The function SEMINFCON should return a vector of  
%    nonlinear inequality constraints, C, a vector of nonlinear equality constraints 
%    Ceq, and NTHETA semi-infinite constraints PHI_1, PHI_2, ..., PHI_NTHETA evaluated 
%    over an interval: [C,Ceq,PHI_1,PHI_2,...,PHI_NTHETA,S]=feval(SEMINFCON,X,S). 
%    S is a recommended sampling interval which may or may not be used.
%    Return [] for C and Ceq if no such constraints exist.  
% 
%    X=FSEMINF(FUN,X0,NTHETA,SEMINFCON,A,B) also tries to satisfy the linear 
%    inequalities A*X <= B.
% 
%    X=FSEMINF(FUN,X0,NTHETA,SEMINFCON,A,B,Aeq,Beq) minimizes subject to the linear equalities
%    Aeq*X = Beq as well.  (Set A=[] and B=[] if no inequalities exist.)
% 
%    X=FSEMINF(FUN,X0,NTHETA,SEMINFCON,A,B,Aeq,Beq,LB,UB) defines a set of lower and upper
%    bounds on the design variables, X, so that the solution is always in 
%    the range LB <= X <= UB. 
% 
%    X=FSEMINF(FUN,X0,NTHETA,SEMINFCON,A,B,Aeq,Beq,LB,UB,OPTIONS) minimizes with the 
%    default optimization parameters replaced by values in the structure OPTIONS, 
%    an argument created with the OPTIMSET function.  See OPTIMSET for details.  Used
%    options are Display, TolX, TolFun, TolCon, DerivativeCheck, Diagnostics, GradObj, 
%    MaxFunEvals, MaxIter, DiffMinChange and DiffMaxChange. Use the GradObj 
%    option to specify that FUN may be called with two output arguments where the 
%    second, G, is the partial derivatives of the function df/dX, at the point X: 
%    [F,G] = feval(FUN,X). 
% 
%    X=FSEMINF(FUN,X0,NTHETA,SEMINFCON,A,B,Aeq,Beq,LB,UB,OPTIONS,P1,P2,...) passes the 
%    problem dependent parameters P1,P2,... directly to the functions FUN and SEMINFCON:
%    feval(FUN,X,P1,P2,...), and feval(SEMINFCON,X,S,P1,P2,...). Use OPTIONS = [] as a 
%    place holder if no options are set.
% 
%    [X,FVAL]=FSEMINF(FUN,X0,NTHETA,SEMINFCON,...) returns the value of the objective 
%    function FUN at the solution X.
% 
%    [X,FVAL,EXITFLAG]=FSEMINF(FUN,X0,NTHETA,SEMINFCON,...) returns a string EXITFLAG that 
%    describes the exit condition of FMINCON.  
%    If EXITFLAG is:
%       1 then FSEMINF converged to a solution X.
%       0 then the maximum number of function evaluations was reached.
%      -1 then FSEMINF did not converge to a solution.
%    
%    [X,FVAL,EXITFLAG,OUTPUT]=FSEMINF(FUN,X0,NTHETA,SEMINFCON,...) returns a structure
%    OUTPUT with the number of iterations taken in OUTPUT.iterations, the number
%    of function evaluations in OUTPUT.funcCount, the algorithm used in OUTPUT.algorithm,
%    the number of CG iterations in OUTPUT.cgiterations, and the first-order optimality
%    in OUTPUT.firstorderopt.  
% 
%    [X,FVAL,EXITFLAG,OUTPUT,LAMBDA]=FSEMINF(FUN,X0,NTHETA,SEMINFCON,...) returns the 
%    Lagrange multiplier at the solution X: LAMBDA.lower for LB, LAMBDA.upper for UB, 
%    LAMBDA.ineqlin for the linear inequalities, LAMBDA.eqlin is for the linear equalities,
%    LAMBDA.ineqnonlin is for the nonlinear inequalities, and LAMBDA.eqnonlin
%    is for the nonlinear equalities.

function fgoalattain
%MATLAB Tour Partial Function Help:  opt_con
%
% FGOALATTAIN Solves the multi-objective goal attainment optimization problem.
% 
%    X = FGOALATTAIN(FUN,X0,GOAL,WEIGHT)
%    tries to make the objective functions (F) supplied by FUN
%    (usually an M-file: FUN.M)  attain the goals (GOAL) by varying X.
% 
%    In doing so the following nonlinear programming problem is solved:
%             min     { LAMBDA :  F(X)-WEIGHT.*LAMBDA<=GOAL } 
%           X,LAMBDA  
% 
%    The function FUN should return the values of the objectives, F when
%    called using feval: F=feval(FUN,X).
% 
%    X=FGOALATTAIN(FUN,X0,GOAL,WEIGHT,A,B) solves the goal attainment problem
%    subject to the linear inequalities A*X <= B.
% 
%    X=FGOALATTAIN(FUN,X0,GOAL,WEIGHT,A,B,Aeq,Beq) solves the goal attainment problem
%    subject to the linear equalities Aeq*X = Beq as well.  (Set A=[] and B=[] 
%    if no inequalities exist.)
% 
%    X=FGOALATTAIN(FUN,X0,GOAL,WEIGHT,A,B,Aeq,Beq,LB,UB) defines a set of lower 
%    and upper bounds on the design variables, X, so that the solution is always in 
%    the range LB <= X <= UB. 
%    
%    X=FGOALATTAIN(FUN,X0,GOAL,WEIGHT,A,B,Aeq,Beq,LB,UB,NONLCON) subjects the 
%    goal attainment problem to the constraints defined in NONLCON (usually an 
%    M-file: NONLCON.m). The function NONLCON should return the vectors
%    C and Ceq, representing the nonlinear inequalities and equalities respectively, 
%    when called with feval: [C, Ceq] = feval(NONLCON,X). FGOALATTAIN 
%    optimizes such that C(X)<=0 and Ceq(X)=0.
% 
%    X=FGOALATTAIN(FUN,X0,GOAL,WEIGHT,A,B,Aeq,Beq,LB,UB,NONLCON,OPTIONS) minimizes the 
%    with default optimization parameters replaced by values in the structure OPTIONS, 
%    an argument created with the OPTIMSET function.  See OPTIMSET for details.  Used
%    options are Display, TolX, TolFun, TolCon, DerivativeCheck, GradObj, GradConstr, 
%    MaxFunEvals, MaxIter, MeritFunction, GoalsExactAchieve, Diagnostics, DiffMinChange, 
%    and DiffMaxChange. Use the GradObj option to specify that FUN may be called with 
%    two output arguments where the second, G, is the partial derivatives of the
%    function df/dX, at the point X: [F,G] = feval(FUN,X). Use the GradConstr
%    option to specify that NONLCON may be called with four output arguments:
%    [C,Ceq,GC,GCeq] = feval(NONLCON,X) where GC is the partial derivatives of the 
%    constraint vector of inequalities C an GCeq is the partial derivatives of the 
%    constraint vector of equalities Ceq. Use OPTIONS = [] as a place holder if 
%    no options are set.
% 
%    X=FGOALATTAIN(FUN,X0,GOAL,WEIGHT,A,B,Aeq,Beq,LB,UB,NONLCON,OPTIONS,P1,P2,...)
%    passes the problem-dependent parameters P1,P2,... directly to the 
%    functions FUN and NONLCON: feval(FUN,X,P1,P2,...) and feval(NONLCON,X,P1,P2,...).  
%    Pass empty matrices for A, B, Aeq, Beq, LB, UB, NONLCON and OPTIONS to use the 
%    default values.
% 
%    [X,FVAL]=FGOALATTAIN(FUN,X0,...) returns the value of the objective 
%    function FUN at the solution X.
% 
%    [X,FVAL,ATTAINFACTOR]=FGOALATTAIN(FUN,X0,...) returns the attainment factor
%    at the solution X. If ATTAINFACTOR is negative, the goals have been over-
%    achieved; if ATTAINFACTOR is positive, the goals have been under-achieved.
% 
%    [X,FVAL,ATTAINFACTOR,EXITFLAG]=FGOALATTAIN(FUN,X0,...) returns a string 
%    EXITFLAG that describes the exit condition of FGOALATTAIN.  
%    If EXITFLAG is:
%       1 then FGOALATTAIN converged to a solution X.
%       0 then the maximum number of function evaluations was reached.
%      -1 then FGOALATTAIN did not converge to a solution.
%    
%    [X,FVAL,ATTAINFACTOR,EXITFLAG,OUTPUT]=FGOALATTAIN(FUN,X0,...) returns a structure
%    OUTPUT with the number of iterations taken in OUTPUT.iterations, the number
%    of function evaluations in OUTPUT.funcCount, the algorithm used in OUTPUT.algorithm,
%    the number of CG iterations in OUTPUT.cgiterations, and the first-order optimality
%    in OUTPUT.firstorderopt.  
%  
%    [X,FVAL,ATTAINFACTOR,EXITFLAG,OUTPUT,LAMBDA]=FGOALATTAIN(FUN,X0,...) returns 
%    the Lagrange multiplier at the solution X: LAMBDA.lower for LB, LAMBDA.upper 
%    for UB, LAMBDA.ineqlin is for the linear inequalities, LAMBDA.eqlin is for 
%    the linear equalities, LAMBDA.ineqnonlin is for the nonlinear inequalities, 
%    and LAMBDA.eqnonlin is for the nonlinear equalities.
% 
%    For more details, type the M-file FGOALATTAIN.M.
% 
%    

function fminimax
%MATLAB Tour Partial Function Help:  opt_con
%
% FMINIMAX Finds a minimax solution of a function of several variables.
%    FMINIMAX solves the following problem:
%    min (max {FUN(X} )  where FUN and X can be vectors or matrices.
%     X 
%  
%    X=MINIMAX(FUN,X0) starts at X0 and finds a minimax solution X to 
%    the functions described in FUN (usually an M-file: FUN.M). FUN
%    should return the values F, at X, of the functions to be minimized 
%    when called with feval: F = feval(FUN,X).
% 
%    X=FMINIMAX(FUN,X0,A,B) solves the minimax problem subject to the
%    linear inequalities A*X <= B.
% 
%    X=FMINIMAX(FUN,X0,A,B,Aeq,Beq) solves the minimax problem
%    subject to the linear equalities Aeq*X = Beq as well.  (Set A=[] and B=[] 
%    if no inequalities exist.)
% 
%    X=FMINIMAX(FUN,X0,A,B,Aeq,Beq,LB,UB) defines a set of lower 
%    and upper bounds on the design variables, X, so that the solution is 
%    always in the range LB <= X <= UB. 
%    
%    X=FMINIMAX(FUN,X0,A,B,Aeq,Beq,LB,UB,NONLCON) subjects the 
%    goal attainment problem to the constraints defined in NONLCON (usually an 
%    M-file: NONLCON.m). The function NONLCON should return the vectors
%    C and Ceq, representing the nonlinear inequalities and equalities 
%    respectively, when called with feval: [C, Ceq] = feval(NONLCON,X). FMINIMAX 
%    optimizes such that C(X)<=0 and Ceq(X)=0.
% 
%    X=FMINIMAX(FUN,X0,A,B,Aeq,Beq,LB,UB,NONLCON,OPTIONS) minimizes with the 
%    default optimization parameters replaced by values in the structure 
%    OPTIONS, an argument created with the OPTIMSET function.  See OPTIMSET 
%    for details.  Used options are Display, TolX, TolFun, TolCon, 
%    DerivativeCheck, GradObj, GradConstr, MaxFunEvals, MaxIter, MeritFunction, 
%    MinAbsMax, Diagnostics, DiffMinChange and DiffMaxChange. Use the GradObj 
%    option to specify that FUN may be called with two output arguments where 
%    the second, G, is the partial derivatives of the function df/dX, at the 
%    point X: [F,G] = feval(FUN,X). Use the GradConstr option to specify that 
%    NONLCON may be called with four output arguments: 
%    [C,Ceq,GC,GCeq] = feval(NONLCON,X) where GC is the partial derivatives of 
%    the constraint vector of inequalities C an GCeq is the partial derivatives 
%    of the constraint vector of equalities Ceq. Use OPTIONS = [] as a place 
%    holder if no options are set.
% 
%    X=FMINIMAX(FUN,X0,A,B,Aeq,Beq,LB,UB,NONLCON,OPTIONS,P1,P2,...)
%    passes the problem-dependent parameters P1,P2,... directly to the 
%    functions FUN and NONLCON: feval(FUN,X,P1,P2,...) and 
%    feval(NONLCON,X,P1,P2,...). Pass empty matrices for A, B, Aeq, Beq, LB, UB, 
%    NONLCON and OPTIONS to use the default values.
% 
%    [X,FVAL]=FMINIMAX(FUN,X0,...) returns the value of the objective 
%    functions at the solution X: FVAL=feval(FUN,X).
% 
%    [X,FVAL,MAXFVAL]=FMINIMAX(FUN,X0,...) returns MAXFVAL = max { FUN(X) } 
%    at the solution X.
% 
%    [X,FVAL,MAXFVAL,EXITFLAG]=FMINIMAX(FUN,X0,...) returns a string EXITFLAG  
%    that describes the exit condition of FMINIMAX.  
%    If EXITFLAG is:
%       1 then FMINIMAX converged to a solution X.
%       0 then the maximum number of function evaluations was reached.
%      -1 then FMINIMAX did not converge to a solution.
%    
%    [X,FVAL,MAXFVAL,EXITFLAG,OUTPUT]=FMINIMAX(FUN,X0,...) returns a structure
%    OUTPUT with the number of iterations taken in OUTPUT.iterations, the number
%    of function evaluations in OUTPUT.funcCount, the algorithm used in 
%    OUTPUT.algorithm, the number of CG iterations in OUTPUT.cgiterations, and 
%    the first-order optimality in OUTPUT.firstorderopt.  
% 
%    [X,FVAL,MAXFVAL,EXITFLAG,OUTPUT,LAMBDA]=FMINIMAX(FUN,X0,...) returns the 
%    Lagrange multipliers at the solution X: LAMBDA.lower for LB, LAMBDA.upper 
%    for UB, LAMBDA.ineqlin is for the linear inequalities, LAMBDA.eqlin is for 
%    the linear equalities, LAMBDA.ineqnonlin is for the nonlinear inequalities, 
%    and LAMBDA.eqnonlin is for the nonlinear equalities.
% 
%    

function lsqlin
%MATLAB Tour Partial Function Help:  opt_con
%
% LSQLIN Constrained linear least squares.
%    X=LSQLIN(C,d,A,b) solves the least-squares problem
% 
%            min  0.5*(NORM(C*x-d)).^2       subject to    A*x <= b
%             x
% 
%    where C is m-by-n.
% 
%    X=LSQLIN(C,d,A,b,Aeq,beq) solves the least-squares
%    (with equality constraints) problem:
% 
%            min  0.5*(NORM(C*x-d)).^2    subject to 
%             x                               A*x <= b and Aeq*x = beq
% 
%    X=LSQLIN(C,d,A,b,Aeq,beq,LB,UB) defines a set of lower and upper
%    bounds on the design variables, X, so that the solution  
%    is always in the range LB <= X <= UB.
% 
%    X=LSQLIN(C,d,A,b,Aeq,beq,LB,UB,X0) sets the starting point to X0.
% 
%    X=LSQLIN(C,d,A,b,Aeq,beq,LB,UB,X0,OPTIONS) minimizes with the default 
%    optimization parameters replaced by values in the structure OPTIONS, an 
%    argument created with the OPTIMSET function.  See OPTIMSET for details. 
%    Used options are Display, Diagnostics, TolFun, LargeScale, MaxIter, 
%    PrecondBandWidth, TypicalX, TolPCG, and MaxPCGIter. Currently, only
%    'final' and 'off' are valid values for the parameter Display ('iter'
%    is not available).
% 
%    [X,RESNORM]=LSQLIN(C,d,A,b) returns the value of the squared 2-norm of the
%    residual: norm(C*X-d)^2.
% 
%    [X,RESNORM,RESIDUAL]=LSQLIN(C,d,A,b) returns the residual: C*X-d.
% 
%    [X,RESNORM,RESIDUAL,EXITFLAG] = LSQLIN(C,d,A,b) returns an EXITFLAG that 
%    describes the exit condition of LSQNONNEG.  
%    If EXITFLAG is:
%       > 0 then LSQLIN converged with a solution X.
%       < 0 then the problem is unbounded, infeasible, or 
%          LSQLIN failed to converge with a solution X. 
%       0 then the maximum number of iterations was exceeded (only occurs
%          with large-scale method).
% 
%    [X,RESNORM,RESIDUAL,EXITFLAG,OUTPUT] = LSQLIN(C,d,A,b) returns a
%    structure OUTPUT with the number of iterations taken in OUTPUT.iterations.
% 
%    [x,RESNORM,RESIDUAL,EXITFLAG,OUTPUT,LAMBDA]=LSQLIN(C,d,A,b) returns the 
%    set of Lagrangian multipliers LAMBDA, at the solution: LAMBDA.ineqlin 
%    for the linear inequalities C, LAMBDA.eqlin for the linear equalities Ceq, 
%    LAMBDA.lower for LB, and LAMBDA.upper for UB.

function lsqnonneg
%MATLAB Tour Partial Function Help:  opt_con
%
% LSQNONNEG Linear least squares with nonnegativity constraints.
%    X = LSQNONNEG(C,d) returns the vector X that minimizes NORM(C*X - d)
%    subject to X >= 0. C and d must be real.
% 
%    X = LSQNONNEG(C,d,X0) uses X0 as the starting point if all(X0 > 0);
%    otherwise the default is used. The default start point is the 
%    origin (the default is used when X0==[] or when only two input 
%    arguments are provided). 
% 
%    X = LSQNONNEG(C,d,X0,OPTIONS) minimizes with the default optimization
%    parameters replaced by values in the structure OPTIONS, an argument
%    created with the OPTIMSET function.  See OPTIMSET for details.  Used
%    options are Display and TolX. (A default tolerance TolX of 
%    10*MAX(SIZE(C))*NORM(C,1)*EPS is used). 
%    
%    [X,RESNORM] = LSQNONNEG(...) also returns the value of the squared 2-norm of 
%    the residual: norm(C*X-d)^2.
% 
%    [X,RESNORM,RESIDUAL] = LSQNONNEG(...) also returns the value of the  
%    residual: C*X-d.
%    
%    [X,RESNORM,RESIDUAL,EXITFLAG] = LSQNONNEG(...) returns an EXITFLAG that 
%    describes the exit condition of LSQNONNEG.  
%    If EXITFLAG is:
%      1 then LSQNONNEG converged with a solution X.
%      0 then the iteration count was exceeded. Increasing the tolerance
%        (OPTIONS.TolX) may lead to a solution.
%   
%    [X,RESNORM,RESIDUAL,EXITFLAG,OUTPUT] = LSQNONNEG(...) returns a structure
%    OUTPUT with the number of steps taken in OUTPUT.iterations and the type 
%    of algorithm used in OUTPUT.algorithm.
% 
%    [X,RESNORM,RESIDUAL,EXITFLAG,OUTPUT,LAMBDA] = LSQNONNEG(...) returns 
%    the dual vector LAMBDA  where LAMBDA(i) <= 0 when X(i) is (approximately) 0 
%    and LAMBDA(i) is (approximately) 0 when X(i) > 0.
%  
%    

function lsqcurvefit
%MATLAB Tour Partial Function Help:  opt_con
%
% LSQCURVEFIT Solves non-linear least squares problems.
%    LSQCURVEFIT solves problems of the form:
%    min  sum {(FUN(X,XDATA)-YDATA).^2}  where X, XDATA, YDATA and the values 
%     X                                  returned by FUN can be vectors or 
%                                        matrices.
% 
%    X=LSQCURVEFIT(FUN,X0,XDATA,YDATA) starts at X0 and finds
%    coefficients X to best fit the nonlinear function FUN(X,XDATA) 
%    to the data YDATA (in the least-squares sense). FUN is an M-file 
%    that computes a function of X and XDATA and returns a matrix of 
%    the objective function values: F=FUN(X,XDATA). 
%    NOTE: YDATA must be the same size as the matrix F returned by FUN. 
% 
%    X=LSQCURVEFIT(FUN,X0,XDATA,YDATA,LB,UB) defines a set of lower and upper
%    bounds on the design variables, X, so that the solution is always in
%    the range LB <= X <= UB.  You may use empty matrices for LB and UB
%    if no bounds exist. Set LB(i) = -inf if X(i) is unbounded below; 
%    set UB(i) = inf if X(i) is unbounded above.
% 
%    X=LSQCURVEFIT(FUN,X0,XDATA,YDATA,LB,UB,OPTIONS) minimizes with the default
%    parameters replaced by values in the structure OPTIONS, an argument
%    created with the OPTIMSET function.  See OPTIMSET for details.  Used
%    options are Display, TolX, TolFun, DerivativeCheck, Diagnostics, Jacobian,
%    JacobPattern, LineSearchType, LevenbergMarquardt, MaxFunEvals, MaxIter, 
%    DiffMinChange and DiffMaxChange, LargeScale, MaxPCGIter, PrecondBandWidth,
%    TolPCG, TypicalX. Use the Jacobian option to specify that FUN may be 
%    called with two output arguments where the second, J, is the Jacobian 
%    matrix: [F,J] = feval(FUN,X,XDATA). If FUN returns a vector (matrix) of m 
%    components when X has length n, then J is an m-by-n matrix where J(i,j) 
%    is the partial derivative of F(i) with respect to x(j). (Note that the 
%    Jacobian J is the transpose of the gradient of F.)
% 
%    X=LSQCURVEFIT(FUN,X0,XDATA,YDATA,LB,UB,OPTIONS,P1,P2,..) passes the 
%    problem-dependent parameters P1,P2,... directly to the function FUN: 
%    FUN(X,XDATA,P1,P2,...).  Pass empty matrices for OPTIONS to use the 
%    default values.
% 
%    [X,RESNORM]=LSQCURVEFIT(FUN,X0,XDATA,YDATA,...) returns the value of the
%    squared 2-norm of the residual at X: sum {(FUN(X,XDATA)-YDATA).^2}.
% 
%    [X,RESNORM,RESIDUAL]=LSQCURVEFIT(FUN,X0,...) returns the value of residual,
%    FUN(X,XDATA)-YDATA, at the solution X. 
% 
%    [X,RESNORM,RESIDUAL,EXITFLAG]=LSQCURVEFIT(FUN,X0,XDATA,YDATA,...) returns 
%    a string EXITFLAG that describes the exit condition of LSQCURVEFIT.  
%    If EXITFLAG is:
%       1 then LSQCURVEFIT converged to a solution X.
%       0 then the maximum number of function evaluations was reached.
%      -1 then LSQCURVEFIT did not converge to a solution.
% 
%    [X,RESNORM,RESIDUAL,EXITFLAG,OUTPUT]=LSQCURVEFIT(FUN,X0,XDATA,YDATA,...) 
%    returns a structure OUTPUT with the number of iterations taken in 
%    OUTPUT.iterations, the number of function evaluations in OUTPUT.funcCount, 
%    the algorithm used in OUTPUT.algorithm, the number of CG iterations in 
%    OUTPUT.cgiterations, and the first-order optimality in OUTPUT.firstorderopt.
% 
%    [X,RESNORM,RESIDUAL,EXITFLAG,OUTPUT,LAMBDA]=LSQCURVEFIT(FUN,X0,XDATA,YDATA,...) 
%    returns the set of Lagrangian multipliers, LAMBDA, at the solution: 
%    LAMBDA.lower for LB and LAMBDA.upper for UB.
% 
%    [X,RESNORM,RESIDUAL,EXITFLAG,OUTPUT,LAMBDA,JACOBIAN]=LSQCURVEFIT(FUN,X0,XDATA,YDATA,...)
%    returns the Jacobian of FUN at X.
% 

function lsqnonlin
%MATLAB Tour Partial Function Help:  opt_con
%
% LSQNONLIN Solves non-linear least squares problems.
%    LSQNONLIN solves problems of the form:
%    min  sum {FUN(X).^2}    where X and the values returned by FUN can be   
%              x             vectors or matrices.
% 
%    X=LSQNONLIN(FUN,X0) starts at the matrix X0 and finds a minimum to the
%    sum of squares of the functions described in FUN. FUN is usually
%    an M-file which returns a vector of objective functions: F=FUN(X).
%    NOTE: FUN should return FUN(X) and not the sum-of-squares 
%    sum(FUN(X).^2)). (FUN(X) is summed and squared implicitly in
%    the algorithm.) See below for more options for FUN.
% 
%    X=LSQNONLIN(FUN,X0,LB,UB) defines a set of lower and upper
%    bounds on the design variables, X, so that the solution is always in
%    the range LB <= X <= UB.  You may use empty matrices for LB and UB
%    if no bounds exist. Set LB(i) = -inf if X(i) is unbounded below; 
%    set UB(i) = inf if X(i) is unbounded above.
% 
%    X=LSQNONLIN(FUN,X0,LB,UB,OPTIONS) minimizes with the default optimization
%    parameters replaced by values in the structure OPTIONS, an argument
%    created with the OPTIMSET function.  See OPTIMSET for details.  Used
%    options are Display, TolX, TolFun, DerivativeCheck, Diagnostics, Jacobian,
%    JacobPattern, LineSearchType, LevenbergMarquardt, MaxFunEvals, MaxIter, 
%    DiffMinChange and DiffMaxChange, LargeScale, MaxPCGIter, PrecondBandWidth,
%    TolPCG, TypicalX. Use the Jacobian option to specify that FUN may be 
%    called with two output arguments where the second, J, is the Jacobian 
%    matrix: [F,J] = feval(FUN,X). If FUN returns a vector (matrix) of m 
%    components when X has length n, then J is an m-by-n matrix where J(i,j) 
%    is the partial derivative of F(i) with respect to x(j). (Note that the 
%    Jacobian J is the transpose of the gradient of F.)
% 
%    X=LSQNONLIN(FUN,X0,LB,UB,OPTIONS,P1,P2,..) passes the 
%    problem-dependent parameters P1,P2,... directly to the functions FUN: 
%    FUN(X,P1,P2,...).  Pass an empty matrix for OPTIONS to use the default 
%    values.
% 
%    [X,RESNORM]=LSQNONLIN(FUN,X0,...) returns 
%    the value of the squared 2-norm of the residual at X: sum(FUN(X).^2). 
% 
%    [X,RESNORM,RESIDUAL]=LSQNONLIN(FUN,X0,...) returns the value of the 
%    residual at the solution X: RESIDUAL = FUN(X).
% 
%    [X,RESNORM,RESIDUAL,EXITFLAG]=LSQNONLIN(FUN,X0,...) returns a string   
%    EXITFLAG that describes the exit condition of LSQNONLIN.  
%    If EXITFLAG is:
%       1 then LSQNONLIN converged to a solution X.
%       0 then the maximum number of function evaluations was reached.
%      -1 then LSQNONLIN did not converge to a solution.
% 
%    [X,RESNORM,RESIDUAL,EXITFLAG,OUTPUT]=LSQNONLIN(FUN,X0,...) returns a 
%    structure OUTPUT with the number of iterations taken in OUTPUT.iterations, 
%    the number of function evaluations in OUTPUT.funcCount, the algorithm used 
%    in OUTPUT.algorithm, the number of CG iterations in OUTPUT.cgiterations,  
%    and the first-order optimality in OUTPUT.firstorderopt.
% 
%    [X,RESNORM,RESIDUAL,EXITFLAG,OUTPUT,LAMBDA]=LSQNONLIN(FUN,X0,...) returns 
%    the set of Lagrangian multipliers, LAMBDA, at the solution: LAMBDA.lower 
%    for LB and LAMBDA.upper for UB.
% 
%    [X,RESNORM,RESIDUAL,EXITFLAG,OUTPUT,LAMBDA,JACOBIAN]=LSQNONLIN(FUN,X0,...) 
%    returns the Jacobian of FUN at X.   
% 

function fzero
%MATLAB Tour Partial Function Help:  opt_con
%
% FZERO  Scalar nonlinear zero finding. 
%    X = FZERO(FUN,X0) tries to find a zero of FUN near X0. FUN (usually 
%    an M-file): FUN.M should take a scalar real value and return a real scalar
%    value when called with feval: F=feval(FUN,X). The value X returned by 
%    FZERO is near a point where FUN changes sign, or NaN if the search fails.  
% 
%    X = FZERO(FUN,X0), where X is a vector of length 2, assumes X0 is an 
%    interval where the sign of FUN(X0(1)) differs from the sign of FUN(X0(2)).
%    An error occurs if this is not true.  Calling FZERO with an interval  
%    guarantees FZERO will return a value near a point where FUN changes 
%    sign.
% 
%    X = FZERO(FUN,X0), where X0 is a scalar value, uses X0 as a starting guess. 
%    FZERO looks for an interval containing a sign change for FUN and 
%    containing X0.  If no such interval is found, NaN is returned.  
%    In this case, the search terminates when the search interval 
%    is expanded until an Inf, NaN, or complex value is found. 
% 
%    X = FZERO(FUN,X0,OPTIONS) minimizes with the default optimization
%    parameters replaced by values in the structure OPTIONS, an argument
%    created with the OPTIMSET function.  See OPTIMSET for details.  Used
%    options are Display and TolX. Use OPTIONS = [] as a place holder if
%    no options are set.
% 
%    X = FZERO(FUN,X0,OPTIONS,P1,P2,...) allows for additional arguments
%    which are passed to the function, F=feval(FUN,X,P1,P2,...).  Pass an empty
%    matrix for OPTIONS to use the default values.
% 
%    [X,FVAL]= FZERO(FUN,...) returns the value of the objective function,
%    described in FUN, at X.
% 
%    [X,FVAL,EXITFLAG] = FZERO(...) returns a string EXITFLAG that 
%    describes the exit condition of FZERO.  
%    If EXITFLAG is:
%       > 0 then FZERO found a zero X
%       < 0 then no interval was found with a sign change, or
%           NaN or Inf function value was encountered during search 
%           for an interval containing a sign change, or
%           a complex function value was encountered during search 
%           for an interval containing a sign change.
%    
%    [X,FVAL,EXITFLAG,OUTPUT] = FZERO(...) returns a structure
%    OUTPUT with the number of iterations taken in OUTPUT.iterations.
% 
%    Example using inline:
%      The argument FUN can be an inline function:
%        f = inline('sin(3*x)');
%        x = fzero(f,2);
%    More examples:
%        fzero('sin', 3) returns pi. Note the quotes around sin.  
%          Ordinarily, functions are defined in M-files.
%        fzero(inline('abs(x)+1'), 1) returns NaN since this function does
%          not change sign anywhere on the real axis (and does not have
%          a zero as well).
%        fzero('sin', 3, optimset('disp','iter')) returns pi, uses 
%          the default tolerance and displays iteration information.
% 
%    

function fsolve
%MATLAB Tour Partial Function Help:  opt_con
%
% FSOLVE Solves nonlinear equations by a least squares method.
% 
%    FSOLVE solves equations of the form:
%              
%    F(X)=0    where F and X may be vectors or matrices.   
% 
%    X=FSOLVE(FUN,X0) starts at the matrix X0 and tries to solve the 
%    equations described in FUN. FUN is usually an M-file which returns 
%    an evaluation of the equations for a particular value of X: F=FUN(X).
% 
%    X=FSOLVE(FUN,X0,OPTIONS) minimizes with the default optimization
%    parameters replaced by values in the structure OPTIONS, an argument
%    created with the OPTIMSET function.  See OPTIMSET for details.  Used
%    options are Display, TolX, TolFun, DerivativeCheck, Diagnostics, Jacobian,
%    JacobPattern, LineSearchType, LevenbergMarquardt, MaxFunEvals, MaxIter, 
%    DiffMinChange and DiffMaxChange, LargeScale, MaxPCGIter, PrecondBandWidth, 
%    TolPCG, TypicalX. Use the Jacobian option to specify that FUN may be called 
%    with two output arguments where the second, J, is the Jacobian matrix: 
%    [F,J] = feval(FUN,X). If FUN returns a vector (matrix) of m components when 
%    X has length n, then J is an m-by-n matrix where J(i,j) is the partial 
%    derivative of F(i) with respect to x(j). (Note that the Jacobian J is the 
%    transpose of the gradient of F.)
% 
%    X=FSOLVE(FUN,X0,OPTIONS,P1,P2,...) passes the problem-dependent 
%    parameters P1,P2,... directly to the function FUN: FUN(X,P1,P2,...).  
%    Pass an empty matrix for OPTIONS to use the default values. 
% 
%    [X,FVAL]=FSOLVE(FUN,X0,...) returns the value of the objective function
%     at X. 
% 
%    [X,FVAL,EXITFLAG]=FSOLVE(FUN,X0,...) returns a string EXITFLAG that 
%    describes the exit condition of FSOLVE.  
%    If EXITFLAG is:
%       1 then FSOLVE converged to a solution X.
%       0 then the maximum number of function evaluations was reached.
%      -1 then FSOLVE did not converge to a solution.
% 
%    [X,FVAL,EXITFLAG,OUTPUT]=FSOLVE(FUN,X0,...) returns a structure
%    OUTPUT with the number of iterations taken in OUTPUT.iterations.
% 
%    [X,FVAL,EXITFLAG,OUTPUT,JACOB]=FSOLVE(FUN,X0,...) returns the 
%    Jacobian of FUN at X.  

function linprog
%MATLAB Tour Partial Function Help:  opt_con
%
% LINPROG     Linear programming.                   
%    X=LINPROG(f,A,b) solves the linear programming problem:
%         
%             min f'*x    subject to:   A*x <= b 
%              x
% 
%    X=LINPROG(f,A,b,Aeq,beq) solves the problem above while additionally
%    satisfying the equality constraints Aeq*x = beq.
%    
%    X=LINPROG(f,A,b,Aeq,beq,LB,UB) defines a set of lower and upper
%    bounds on the design variables, X, so that the solution is always in
%    the range LB <= X <= UB.  If LB is [] or if any of the entries in LB are 
%    -Inf, that is taken to mean the corresponding variable is not bounded below.
%    If UB is [] or if any of the entries in UB are Inf, that is
%    taken to mean the corresponding variable is not bounded above.
% 
%    X=LINPROG(f,A,b,Aeq,beq,LB,UB,X0) sets the starting point to X0.  This
%    option is only available with the active-set algorithm.  The default
%    interior point algorithm will ignore any non-empty starting point.
% 
%    X=LINPROG(f,A,b,Aeq,Beq,LB,UB,X0,OPTIONS) minimizes with the default 
%    optimization parameters replaced by values in the structure OPTIONS, an 
%    argument created with the OPTIMSET function.  See OPTIMSET for details.  
%    Use options are Display, Diagnostics, TolFun, LargeScale, MaxIter. 
%    Currently, only 'final' and 'off' are valid values for the parameter 
%    Display when LargeScale is 'off' ('iter' is valid when LargeScale is 'on').
% 
%    [X,FVAL]=LINPROG(f,A,b) returns the value of the objective function at X:
%    FVAL = f'*X.
% 
%    [X,FVAL,EXITFLAG] = LINPROG(f,A,b) returns EXITFLAG that 
%    describes the exit condition of LINPROG.
%    If EXITFLAG is:
%       > 0 then LINPROG converged with a solution X.
%       0 then LINPROG reached the maximum number of iterations without converging.
%       < 0 then the problem was infeasible or LINPROG failed.
% 
%    [X,FVAL,EXITFLAG,OUTPUT] = LINPROG(f,A,b) returns a structure
%    OUTPUT with the number of iterations taken in OUTPUT.iterations, the type
%    of algorithm used in OUTPUT.algorithm, the number of conjugate gradient
%    iterations (if used) in OUTPUT.cgiterations.
% 
%    [X,FVAL,EXITFLAG,OUTPUT,LAMBDA]=LINPROG(f,A,b) returns the set of 
%    Lagrangian multipliers LAMBDA, at the solution: LAMBDA.ineqlin for the 
%    linear inequalities A, LAMBDA.eqlin for the linear equalities Aeq, 
%    LAMBDA.lower for LB, and LAMBDA.upper for UB.
%    
%    NOTE: the LargeScale (the default) version of LINPROG uses a primal-dual
%          method. Both the primal problem and the dual problem must be feasible 
%          for convergence. Infeasibility messages of either the primal or dual, 
%          or both, are given as appropriate.  The primal problem in standard 
%          form is 
%               min f'*x such that A*x = b, x >= 0.
%          The dual problem is
%               max b'*y such that A'*y + s = f, s >= 0.

function quadprog
%MATLAB Tour Partial Function Help:  opt_con
%
% QUADPROG Quadratic programming. 
%    X=QUADPROG(H,f,A,b) solves the quadratic programming problem:
% 
%             min 0.5*x'*H*x + f'*x   subject to:  A*x <= b 
%              x    
% 
%    X=QUADPROG(H,f,A,b,Aeq,beq) solves the problem above while additionally
%    satisfying the equality constraints Aeq*x = beq.
% 
%    X=QUADPROG(H,f,A,b,Aeq,beq,LB,UB) defines a set of lower and upper
%    bounds on the design variables, X, so that the solution is in the 
%    range LB <= X <= UB.
% 
%    X=QUADPROG(H,f,A,b,Aeq,beq,LB,UB,X0) sets the starting point to X0.
% 
%    X=QUADPROG(H,f,A,b,Aeq,beq,LB,UB,X0,OPTIONS) minimizes with the default 
%    optimization parameters replaced by values in the structure OPTIONS, an 
%    argument created with the OPTIMSET function.  See OPTIMSET for details.  
%    Used options are Display, Diagnostics, TolX, TolFun, LargeScale, MaxIter, 
%    PrecondBandWidth, TypicalX, TolPCG, and MaxPCGIter. Currently, only
%    'final' and 'off' are valid values for the parameter Display ('iter'
%    is not available).
% 
%    [X,FVAL]=QUADPROG(H,f,A,b) returns the value of the objective function at X:
%    FVAL = 0.5*X'*H*X + f'*X.
% 
%    [X,FVAL,EXITFLAG] = QUADPROG(H,f,A,b) returns a string EXITFLAG that 
%    describes the exit condition of QUADPROG.  
%    If EXITFLAG is:
%       > 0 then QUADPROG converged with a solution X.
%       < 0 then the problem is unbounded, infeasible, or 
%           QUADPROG failed to converge with a solution X.  
%       0 then the maximum number of iterations was exceeded (only occurs
%         with large-scale method).
% 
%    [X,FVAL,EXITFLAG,OUTPUT] = QUADPROG(H,f,A,b) returns a structure
%    OUTPUT with the number of iterations taken in OUTPUT.iterations,
%    the type of algorithm used in OUTPUT.algorithm, the number of conjugate
%    gradient iterations (if used) in OUTPUT.cgiterations, and a measure of
%    first order optimality (if used) in OUPUT.firstorderopt.
% 
%    [X,FVAL,EXITFLAG,OUTPUT,LAMBDA]=QUADPROG(H,f,A,b) returns the set of 
%    Lagrangian multipliers LAMBDA, at the solution: LAMBDA.ineqlin for the 
%    linear inequalities A, LAMBDA.eqlin for the linear equalities Aeq, 
%    LAMBDA.lower for LB, and LAMBDA.upper for UB.

function optimset
%MATLAB Tour Partial Function Help:  opt_con
%
% OPTIMSET Create/alter OPTIM OPTIONS structure.
%    OPTIONS = OPTIMSET('PARAM1',VALUE1,'PARAM2',VALUE2,...) creates an
%    optimization options structure OPTIONS in which the named parameters have
%    the specified values.  Any unspecified parameters are set to [] (parameters
%    with value [] indicate to use the default value for that parameter when OPTIONS 
%    is passed to the optimization function). It is sufficient to type only the 
%    leading characters that uniquely identify the parameter.  Case is ignored for 
%    parameter names.  
%    NOTE: For values that are strings, correct case and the complete string are required;
%    if an invalid string is provided, the default is used.
%    
%    OPTIONS = OPTIMSET(OLDOPTS,'PARAM1',VALUE1,...) creates a copy of OLDOPTS with
%    the named parameters altered with the specified values.
%    
%    OPTIONS = OPTIMSET(OLDOPTS,NEWOPTS) combines an existing options structure
%    OLDOPTS with a new options structure NEWOPTS.  Any parameters in NEWOPTS
%    with non-empty values overwrite the corresponding old parameters in OLDOPTS. 
%    
%    OPTIMSET with no input arguments and no output arguments displays all 
%    parameter names and their possible values.
% 
%    OPTIONS = OPTIMSET (with no input arguments) creates an options structure
%    OPTIONS where all the fields are set to [].
% 
%    OPTIONS = OPTIMSET(OPTIMFUNCTION) creates an options structure with all
%    the parameter names and default values relevant to the optimization
%    function named in OPTIMFUNCTION. For example,
%            optimset('fminbnd') 
%    returns an options structure containing all the parameter names and default 
%    values relevant to the function 'fminbnd'.
%    
% OPTIMSET PARAMETERS
% DerivativeCheck - Compare user supplied derivatives (gradients or Jacobian)
%                   to finite-differencing derivatives  [ on | {off}]
% Diagnostics - Print diagnostic information about the function to be minimized
%               or solved [ on | {off}]
% DiffMaxChange - Maximum change in variables for finite difference gradients
%               [ positive scalar  | {1e-1} ]
% DiffMinChange - Minimum change in variables for finite difference gradients
%               [ positive scalar  | {1e-8} ]
% Display - Level of display [ off | iter | {final} ]  
% GoalsExactAchieve - Number of goals to achieve exactly (do not over- or
%                     under-achieve) [ positive scalar integer | {0}]
% GradConstr - Gradients for the nonlinear constraints defined by user
%                     [ on | {off} ]
% GradObj - Gradient(s) for the objective function(s) defined by user
%                     [ on | {off}]
% Hessian - Hessian for the objective function defined by user  [ on | {off} ]
% HessPattern - Sparsity pattern of the Hessian for finite-differencing
%               [ sparse matrix ]
% HessUpdate - Quasi-Newton updating scheme 
%              [ {bfgs} | dfp | gillmurray | steepdesc ] 
% Jacobian - Jacobian for the objective function defined by user
% JacobPattern - Sparsity pattern of the Jacobian for finite-differencing
%                [ sparse matrix ]
% LargeScale - Use large-scale algorithm if possible [ {on} | off ]
% LevenbergMarquardt - Chooses Levenberg-Marquardt over Gauss-Newton algorithm
%                      [ on | off]
% LineSearchType - Line search algorithm choice [ cubicpoly | {quadcubic} ]
% MaxFunEvals - Maximum number of function evaluations allowed 
%                    [ positive integer ]
% MaxIter - Maximum number of iterations allowed [ positive integer ]
% MaxPCGIter - Maximum number of PCG iterations allowed [positive integer]
% MeritFunction - Use goal attainment/minimax merit function [ {multiobj} | singleobj ]
% MinAbsMax - Number of F(x) to minimize the worst case absolute values
%                    [ positive scalar integer | {0} ]
% PrecondBandWidth - Upper bandwidth of preconditioner for PCG 
%                     [ positive integer | Inf | {0} ]
% TolCon - Termination tolerance on the constraint violation [ positive scalar ]
% TolFun - Termination tolerance on the function value [ positive scalar ]
% TolPCG - Termination tolerance on the PCG iteration 
%          [ positive scalar | {0.1} ]
% TolX - Termination tolerance on X [ positive scalar ]
% TypicalX - Typical X values [ vector ]
% 
%    

function optimget
%MATLAB Tour Partial Function Help:  opt_con
%
% OPTIMGET Get OPTIM OPTIONS parameters.
%    VAL = OPTIMGET(OPTIONS,'NAME') extracts the value of the named parameter
%    from optimization options structure OPTIONS, returning an empty matrix if
%    the parameter value is not specified in OPTIONS.  It is sufficient to
%    type only the leading characters that uniquely identify the
%    parameter.  Case is ignored for parameter names.  [] is a valid OPTIONS
%    argument.
%    
%    VAL = OPTIMGET(OPTIONS,'NAME',DEFAULT) extracts the named parameter as
%    above, but returns DEFAULT if the named parameter is not specified (is [])
%    in OPTIONS.  For example
%    
%      val = optimget(opts,'TolX',1e-4);
%    
%    returns val = 1e-4 if the TolX property is not specified in opts.
%    
%    

function circustent
%MATLAB Tour Partial Function Help:  opt_con
%
%  This demonstrates that the shape of a circus tent is 
%  determined by a constrained optimization problem
%  that we can solve using the large-scale optimization
%  functionality in the Optimization Toolbox.

function molecule
%MATLAB Tour Partial Function Help:  opt_con
%
%  MOLECULE
%    This demonstration uses the large-scale functionality in 
%    the Optimization Toolbox to solve a two-dimensional Molecule 
%    Conformation Problem.  This type of problem also arises in
%    other applications including satellite ranging and surveying.

function optdeblur
%MATLAB Tour Partial Function Help:  opt_con
%
%  This demo shows how the Optimization Toolbox can be used to 
%  recover a blurred image.  It does this by solving a 
%  large-scale constrained linear least-squares optimization
%  problem.

function optdemo
%MATLAB Tour Partial Function Help:  opt_con
%
%        ------- OPTIMIZATION TOOLBOX Demonstrations---
% 
%        1)  Tutorial Walk Through
%        2)  Banana Function
%        3)  Goal Attainment
%        4)  Data fitting
% 
%        0)      Quit

function tutdemo
%MATLAB Tour Partial Function Help:  opt_con
%
% TUTDEMO Tutorial for Optimization Toolbox.

function bandemo
%MATLAB Tour Partial Function Help:  opt_con
%
% BANDEMO Banana function minimization demonstration.
%    
%    This script-file demonstrates the minimization of the 
%    the banana function:  
%     
%            f(x)= 100*(x(2)-x(1)^2)^2+(1-x(1))^2 
%  
%    It is called the banana function because of the way the  
%    curvature bends around the origin (also called Rosenbrock's 
%    function). It is notorious in optimization examples because 
%    of the slow convergence with which most methods exhibit 
%    when trying to solve this problem. 
%  
%    This function has a unique minimum at the point X=[1,1] f(x)=0. 
%    We demonstrate here a number of techniques for its minimization 
%    starting at the point X=[-1.9,2].
% 
%    In this demo we focus on the algorithms in the Optimization Toolbox
%    for medium-scale problems.
%  

function goaldemo
%MATLAB Tour Partial Function Help:  opt_con
%
% GOALDEMO Demonstration of the goal-attainment method.

function dfildemo
%MATLAB Tour Partial Function Help:  opt_con
%
% DFILDEMO Nonlinear filter design problem using discrete optimization.

function datdemo
%MATLAB Tour Partial Function Help:  opt_con
%
% DATDEMO Nonlinear data fitting demonstration.

