# Curve Fitting

Curve fitting is the process of finding a curve from a set of curves that best matches a series of data points. The set of curves is defined in terms of curve parameters. In other words, curve fitting consists of finding the curve parameters that produce the best match.

There are different ways to determine what is the 'best' match. If the curve has to go through the data points, we have interpolation. In least squares curve fitting, the sum of the squares of the residuals (the difference between the data value and the value predicted by the curve) is minimized. In weighted least squares, each data point is assigned a weight that indicates how much the data point influences the parameters.

A further distinction is made between linear and
nonlinear least squares. In the context of curve fitting,
a linear curve is a curve that is linear in its parameters.
This is regardless of whether the terms are linear in the
curve variable. For example, a quadratic curve,
*y* = *ax*^{2}+*bx*+c,
is linear in the parameters *a*, *b*,
and *c*, even though it is nonlinear
in terms of *x*.
On the other hand, the exponential curve
*y = ae ^{bx}*
is linear in

*a*, but nonlinear in

*b*.

**Numerics.NET**
contains classes for linear and nonlinear least squares curve fitting.

In this section: