Calculator
Example data table
| x | y | sigma |
|---|---|---|
| 0 | 1.02 | 0.10 |
| 1 | 2.05 | 0.12 |
| 2 | 2.94 | 0.09 |
| 3 | 3.98 | 0.11 |
| 4 | 4.99 | 0.10 |
| 5 | 5.92 | 0.13 |
Formula used
This tool performs a weighted least squares fit for a polynomial model:
y(x) = c0 + c1 x + c2 x^2 + ... + cD x^D
Each point \((x_i, y_i)\) has a weight \(w_i\). If you provide uncertainties \(\sigma_i\), the weight is \(w_i = 1/\sigma_i^2\).
Coefficients are found by solving the normal equations:
(Aᵀ W A) c = Aᵀ W y
Here \(A\) is the design matrix with polynomial basis terms, \(W\) is a diagonal matrix of weights, and \(c\) is the coefficient vector.
How to use this calculator
- Enter your dataset as rows of x y or x y z.
- Choose how to interpret the third column: uncertainty (sigma) or weight (w).
- Select the polynomial degree and whether to include an intercept.
- Optionally list x values for predictions, one per line.
- Press Compute weighted fit to view results above the form.