Fitting data with error bars
Suppose you have data (xi,yi), with uncertainties σi in the y-values. Let
Un=∑ixniσ2i,Wn=∑iyixniσ2i,
and let
D=U0U2−U21.
Then the best fit line is given by
slope=U0W1−U1W0D,intercept=U2W0−U1W1D,
with uncertainties
σ2slope=U0D,σ2intercept=U2D.
As part of your homework, you will write a function which implements this method.
No comments:
Post a Comment