Linear Least Squares Fit with Error Bars: A MATLAB Tutorial

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 5K views
Simfish
Gold Member
Messages
811
Reaction score
2
With MATLAB or something. Basically, I just have a bunch of data points where I should do a linear least squares fit, but each of the points have error bars around them.
 
Physics news on Phys.org


Simfish said:
With MATLAB or something. Basically, I just have a bunch of data points where I should do a linear least squares fit, but each of the points have error bars around them.

What you would need is a "weighted least squares fit".
The points must be weighted by 1/variance.

According to google:
In MATLAB, the LSCOV function can perform weighted-least-square regression.