MATLAB MATLAB - Find the error on polynomial fit parameters of experimental data

Click For Summary
To calculate errors on polynomial fit parameters in MATLAB, use the polyfit function, which returns polynomial coefficients and a structure S for error estimation. The structure S includes essential fields like R, degrees of freedom, and the norm of residuals. An estimate of the covariance matrix of the coefficients can be derived from R and the norm of residuals. The polyval function, when used with S, provides error estimates for predictions, ensuring that the bounds contain at least 50% of future observations. For further clarification, refer to the examples provided on the polyfit documentation page.
SK1.618
Messages
8
Reaction score
0
See attached PDF for details: How do I calculate errors on the fit parameters, p?
 

Attachments

Physics news on Phys.org
Check out the doc on polyfit and polyval. In particular,

[p,S] = polyfit(x,y,n) returns the polynomial coefficients p and a structure S for use with polyval to obtain error estimates or predictions. Structure S contains fields R, df, and normr, for the triangular factor from a QR decomposition of the Vandermonde matrix of x, the degrees of freedom, and the norm of the residuals, respectively. If the data y are random, an estimate of the covariance matrix of p is (Rinv*Rinv')*normr^2/df, where Rinv is the inverse of R. If the errors in the data y are independent normal with constant variance, polyval produces error bounds that contain at least 50% of the predictions.

[y,delta] = polyval(p,x,S) uses the optional output structure S generated by polyfit to generate error estimates delta. delta is an estimate of the standard deviation of the error in predicting a future observation at x by p(x). If the coefficients in p are least squares estimates computed by polyfit, and the errors in the data input to polyfit are independent, normal, and have constant variance, then y±delta contains at least 50% of the predictions of future observations at x.

There is also a good example on the polyfit page.
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 8 ·
Replies
8
Views
3K