BL2.ru

Curve fitting online(approximation by formula)

Paste the points — seven model types are fitted by least squares, compared by R², and the best formula is suggested.

Two columns separated by Tab (copied from Excel), semicolon, comma or space; a header row is skipped.
Calculate

What is curve fitting

Approximation replaces a set of points with a simple formula that passes close to them, smoothing measurement errors. Parameters are found by least squares.

Models

ModelFormula
Lineary = a + bx
Quadraticy = a + bx + cx²
Cubicy = a + bx + cx² + dx³
Exponentialy = a·ebx
Powery = a·xb
Logarithmicy = a + b·ln x
Hyperbolicy = a + b/x

Exponential, power and logarithmic models are linearised by taking logarithms; R² is always computed on the original y so models can be compared fairly. The best model is chosen by adjusted R², which penalises extra parameters.

Example

Points (1; 3.3), (2; 5.5), (3; 9.1), (4; 15), (5; 24.6), (6; 40.5) are best described by y ≈ 2·e0.5x.

FAQ

Approximation vs interpolation?
An interpolating curve passes exactly through all points, an approximating one passes close to them and smooths errors.
Why does R² differ from Excel for the exponential trendline?
Excel computes R² on ln y for exponential and power trendlines; here R² uses the original y. Coefficients are the same.
Why is the exponential model unavailable?
It requires all y > 0; the power model requires x > 0 and y > 0, the logarithmic one x > 0, the hyperbolic one x ≠ 0.
Which polynomial degree should I use?
Usually 2 or 3. High degrees overfit noise; for an exact curve through all points use Lagrange or Newton interpolation.