Types of Objective Functions

Many Optimization Toolbox™ solvers minimize a scalar function of a multidimensional vector. The objective function is the function the solvers attempt to minimize. Several solvers accept vector-valued objective functions, and some solvers use objective functions you specify by vectors or matrices.

Objective TypeSolversHow to Write Objectives
Scalar

fmincon

fminunc

fminbnd

fminsearch

fseminf

fzero

Writing Scalar Objective Functions
Nonlinear least squares

lsqcurvefit

lsqnonlin

Writing Vector and Matrix Objective Functions
Multivariable equation solving

fsolve

Multiobjective

fgoalattain

fminimax

Linear programming

linprog

Writing Objective Functions for Linear or Quadratic Problems
Mixed-integer linear programming

intlinprog

Linear least squares

lsqlin

lsqnonneg

Quadratic programming

quadprog