Curve Fitting Calculator

This curve fitting calculator finds the curve that best describes your data. It fits several model families at once, compares them fairly with R², RMSE and AICc, and gives you the equation for predictions.

Same number of values as x.

Checks on your data

  • Enough points for the models fitted, and the prediction (if any) lies inside the data range.

Results

Best model (lowest AICc): Exponential
y = 0.99798 · e^(1.0003x)
R²
1
Adjusted R²
1
RMSE
5.8357
SSE
340.557
AICc (lower is better)
40.994
Model chosen by AICc among those fitted
Exponential
penalises extra parameters
Data with the exponential curve (R² = 1)
010,00020,000246810xy
R² of every model fitted (higher is better, but beware overfitting)
00.5Linear: 0.513906Linear0.514Quadratic: 0.850325Quadratic0.85Cubic: 0.970262Cubic0.97Quartic: 0.996159Quartic0.996Exponential: 0.999999Exponential1Power: 0.332842Power0.333Logarithmic: 0.300794Logarithmic0.301
Model comparison
ModelEquationR²RMSEAICc
Lineary = 1654.9x − 5617.80.51394623174.49
Quadraticy = 529.28x² − 4167.2x + 6026.40.85032565167
Cubicy = 130.66x³ − 1626.6x² + 5776.2x − 5184.30.97031143156.84
Quarticy = 26.29x^4 − 447.72x³ + 2606.1x² − 5791.5x + 3838.40.9962411145.37
Exponential ★y = 0.99798 · e^(1.0003x)15.83640.994
Powery = 0.64387 · x^3.93250.33285416177.66
Logarithmicy = -4414.6 + 5229.5 · ln x0.30085545178.13
Show step-by-step solution
  1. Each model is fitted by least squares: polynomials directly, and exponential, power and logarithmic models by transforming the data with logarithms and fitting a straight line.
  2. Models are then compared on the original y scale using SSE, R², RMSE and AICc, which penalises extra parameters to avoid overfitting.
  3. Selected model: Exponential. y = 0.99798 · e^(1.0003x).
  4. R² = 1 − SSE ÷ SST = 1 − 340.56 ÷ 439,675,520 = 1.
ModelsLinear to quartic, exp, power, log
Compare byR², RMSE, AICc
WarningHigher degree can overfit
OutputEquation and prediction

What Is Curve Fitting?

Curve fitting means choosing a function and estimating its parameters so that it follows your data. Different shapes suit different patterns: a polynomial for general bends, an exponential for growth or decay, a power law for scaling and a logarithmic curve for slowing growth.

Comparing models by R² alone favours complex models, so the calculator also reports adjusted R² and AICc, which penalise extra parameters, and tells you which model AICc prefers. For a fit that is not reducible to a straight line, see the nonlinear regression calculator.

Below you will find the formulas, a variables table, a worked example and answers to common questions such as how to choose between models and why extrapolation is risky.

How to Use the Curve Fitting Calculator

  1. Enter x and y values in matching order (at least 4 points).
  2. Leave the model on “Automatic” to feature the best by AICc, or choose a specific model.
  3. Check the comparison table and the scatter plot. A good fit follows the points without wild swings.
  4. Optionally enter an x to predict y. Be cautious outside the range of your data.

Curve Fitting Formula

Polynomial of degree d

y=a0+a1x+a2x2+⋯+adxdy=a_0+a_1x+a_2x^2+\cdots+a_dx^d

Exponential

y=AeBx  (ln⁡y=ln⁡A+Bx)y=Ae^{Bx}\ \ (\ln y=\ln A+Bx)

Power

y=AxB  (ln⁡y=ln⁡A+Bln⁡x)y=Ax^{B}\ \ (\ln y=\ln A+B\ln x)

Logarithmic

y=a+bln⁡xy=a+b\ln x

Corrected Akaike criterion

AICc=nln⁡SSEn+2k+2k(k+1)n−k−1AICc=n\ln\frac{SSE}{n}+2k+\frac{2k(k+1)}{n-k-1}

Curve Fitting Variables Explained

SymbolMeaningNotes
x, yYour paired data
ŷFitted value from the model
R²Share of variation explained1 − SSE ÷ SST
AICcSmall-sample corrected AICLower is better
RMSERoot mean squared errorSame units as y

Curve Fitting Worked Example

Using the example values (press “Load example” above to try them):

  1. Each model is fitted by least squares: polynomials directly, and exponential, power and logarithmic models by transforming the data with logarithms and fitting a straight line.
  2. Models are then compared on the original y scale using SSE, R², RMSE and AICc, which penalises extra parameters to avoid overfitting.
  3. Selected model: Exponential. y = 0.99798 · e^(1.0003x).
  4. R² = 1 − SSE ÷ SST = 1 − 340.56 ÷ 439,675,520 = 1.

Result: Best model (lowest AICc): Exponential = y = 0.99798 · e^(1.0003x); R² = 1.

Choosing the right type of curve

Draw the scatter plot first. The shape usually tells you which families are plausible, and theory about the process should guide the choice more than R² alone.

Which model suits which pattern?
Pattern in the scatter plotTryTypical example
Straight lineLinearCost vs quantity
One bend, parabolaQuadraticProjectile height, profit vs price
Rapid growth or decay by constant percentageExponentialPopulation, compound interest, radioactive decay
Straight on a log-log plotPowerArea vs length, allometric scaling
Fast then levelling offLogarithmicLearning curves, diminishing returns
S-shapedLogistic (use non-linear regression)Adoption, saturation

Overfitting: why R² alone is not enough

A polynomial of degree n − 1 passes exactly through n points and gives R² = 1, yet it is useless for prediction because it wiggles between the points. Adjusted R² and AICc penalise complexity. Prefer the simplest model that captures the pattern, and when you can, test the model on data it was not fitted to.

How the fits are computed

Polynomials are fitted by least squares on centred data for numerical stability. Exponential and power curves are fitted by taking logarithms and fitting a straight line, which is fast and robust but minimises error on the log scale; for the exact least squares fit on the original scale, use the non-linear regression calculator. All models are then compared using errors measured on the original y values.

Cautions

  • Extrapolating polynomial curves beyond the data can give absurd values.
  • Exponential and power fits require positive y (and positive x for power and log).
  • Outliers can distort a fit; check residuals.
  • A good fit does not prove the model reflects the underlying mechanism.

Where Curve Fitting Is Used

Finding a trend equation

Getting a formula that describes how y changes with x.

Comparing candidate models

Judging which shape fits the data best without just chasing R².

Interpolation

Estimating values between the measured points.

Lab and coursework

Fitting measured data to a model and reporting the equation.

Common Curve Fitting Mistakes to Avoid

  • Use the lowest degree that fits well.
  • Compare models by AICc, not R² alone.
  • Transform checks: a straight line on semi-log paper suggests exponential; on log-log suggests a power law.

Curve Fitting Terms and Definitions

Overfitting
A model so flexible that it fits noise rather than the underlying pattern.
AICc
Akaike information criterion corrected for small samples; lower is better.
RMSE
Root mean squared error of the fit, in the units of y.

Curve Fitting FAQs

What is curve fitting?

Finding a function whose graph follows your data points as closely as possible, using a criterion such as least squares.

How do I choose between a polynomial and an exponential fit?

Look at the plot and the physical process. Compare AICc and adjusted R². If growth is by a constant percentage, exponential is usually right.

Why does a high-degree polynomial fit so well but predict badly?

It adapts to random noise in the points and oscillates between and beyond them. This is overfitting.

What does R² mean for a curve fit?

The share of the variation in y explained by the curve. It is 1 for a perfect fit, though that may be overfitting.

Why do some models not appear?

Exponential and power models need positive y, and power and logarithmic models need positive x.

Can I get the exact least squares exponential fit?

This tool fits via logarithms. For an exact non-linear least squares fit of y = Ae^{Bx}, use the non-linear regression calculator.

Related calculators

Last updated 2026-11-09. See our disclaimer.