# 曲線擬合

## 类型

### Fitting functions to data points

Most commonly, one fits a function of the form y=f(x).

### 拟合直線或多項式曲線

${\displaystyle y=ax^{2}+bx+c\;}$

${\displaystyle y=ax^{3}+bx^{2}+cx+d\;}$

• 即使存在精确的拟合，也不意味着必须得到这样的拟合。根据使用的算法不同，我们可能遇到分歧，要么精确的拟合无法得到，要么需要太多的计算机时去得到精确的拟合。不管哪种情况，最终都会以得到近似拟合而结束。
• 通常人們會希望得到一个近似的拟合，而不愿为了精确拟合数据而使拟合的曲线产生扭曲。
• 高次多项式往往有高度波动的特性。如果我们通过两点“A”和“B”作一条曲线，我们希望这条曲线也能通过“A”和“B”的中点。但是对于高次多项式，情况就不是这样了，高次多项式曲线往往可能有很大或者很小的幅值。对于低次多项式，曲线将没有很大波动，而能通过中点（对于一次多项式，甚至能保证肯定通过中点）。

#### Fitting other functions to data points

Other types of curves, such as trigonometric functions (such as sine and cosine), may also be used, in certain cases.

In spectroscopy, data may be fitted with Gaussian, Lorentzian, Voigt and related functions.

In agriculture the inverted logistic sigmoid function (S-curve) is used to describe the relation between crop yield and growth factors. The blue figure was made by a sigmoid regression of data measured in farm lands. It can be seen that initially, i.e. at low soil salinity, the crop yield reduces slowly at increasing soil salinity, while thereafter the decrease progresses faster.

### Fitting plane curves to data points

If a function of the form ${\displaystyle y=f(x)}$  cannot be postulated, one can still try to fit a plane curve.

Other types of curves, such as conic sections (circular, elliptical, parabolic, and hyperbolic arcs) or trigonometric functions (such as sine and cosine), may also be used, in certain cases. For example, trajectories of objects under the influence of gravity follow a parabolic path, when air resistance is ignored. Hence, matching trajectory data points to a parabolic curve would make sense. Tides follow sinusoidal patterns, hence tidal data points should be matched to a sine wave, or the sum of two sine waves of different periods, if the effects of the Moon and Sun are both considered.

For a parametric curve, it is effective to fit each of its coordinates as a separate function of arc length; assuming that data points can be ordered, the chord distance may be used.[1]

#### Fitting a circle by geometric fit

Circle fitting with the Coope method, the points describing a circle arc, centre (1 ; 1), radius 4.

different models of ellipse fitting

Ellipse fitting minimising the algebraic distance (Fitzgibbon method).

Coope[2] approaches the problem of trying to find the best visual fit of circle to a set of 2D data points. The method elegantly transforms the ordinarily non-linear problem into a linear problem that can be solved without using iterative numerical methods, and is hence an order of magnitude faster than previous techniques.

#### Fitting an ellipse by geometric fit

The above technique is extended to general ellipses[3] by adding a non-linear step, resulting in a method that is fast, yet finds visually pleasing ellipses of arbitrary orientation and displacement.

## 参考资料

1. ^ p.51 in Ahlberg & Nilson (1967) The theory of splines and their applications, Academic Press, 1967 [1]
2. ^ Coope, I.D. Circle fitting by linear and nonlinear least squares. Journal of Optimization Theory and Applications. 1993, 76 (2): 381–388. doi:10.1007/BF00939613.
3. ^ Paul Sheer, A software assistant for manual stereo photometrology, M.Sc. thesis, 1997