Pro 🔒~20 min

Curve Fitting

Fit equations to data and analyze residuals

How it works

Curve fitting finds mathematical functions that best match experimental data. The quality of fit is measured by R², which ranges from 0 (no fit) to 1 (perfect fit). Residuals (differences between data and fit) should be randomly distributed for a good model. Choosing the right functional form requires understanding the underlying physics or phenomenon.

Upgrade to Pro to access this experiment

Step-by-step

  1. Click to add data points or load a preset dataset.
  2. Select a fit type and observe how the curve adjusts.
  3. Check residual plot for systematic patterns.
  4. Higher R² means a better fit, but more parameters always improve R² — use physical intuition.

Key formulas

  • R2=1SSresSStotR^2 = 1 - \frac{SS_{res}}{SS_{tot}}Coefficient of determination
  • y=mx+by = mx + bLinear fit
  • y=ax2+bx+cy = ax^2 + bx + cQuadratic fit

Frequently asked questions

A set of (x, y) data falls perfectly on y=3x+2. What R² should you expect from a linear fit?
A perfect linear fit gives R² = 1.0.
Why is a quadratic fit always at least as good as a linear fit for the same data?
More parameters = more flexibility; set a=0 to reduce to linear.
Your residuals form a sinusoidal pattern. What does this suggest about your model?
Systematic residuals mean the model is missing a periodic component.