User`s guide
3 Fitting Data
3-14
Nonlinear Least Squares
The Curve Fitting Toolbox uses the nonlinear least squares formulation to fit
a nonlinear model to data. A nonlinear model is defined as an equation that is
nonlinear in the coefficients, or a combination of linear and nonlinear in the
coefficients. For example, Gaussians, ratios of polynomials, and power
functions are all nonlinear.
In matrix form, nonlinear models are given by the formula
where
• y is an n-by-1 vector of responses.
• f is a function of β and X.
• β is a m-by-1 vector of coefficients.
• X is the n-by-m design matrix for the model.
• ε is an n-by-1 vector of errors.
Nonlinear models are more difficult to fit than linear models because the
coefficients cannot be estimated using simple matrix techniques. Instead, an
iterative approach is required that follows these steps:
1 Start with an initial estimate for each coefficient. For some nonlinear
models, a heuristic approach is provided that produces reasonable starting
values. For other models, random values on the interval [0,1] are provided.
2 Produce the fitted curve for the current set of coefficients. The fitted
response value is given by
and involves the calculation of the Jacobian of f(X,b), which is defined as a
matrix of partial derivatives taken with respect to the coefficients.
yfXβ,()ε+=
y
ˆ
y
ˆ
fXb,()=