Graphics Programs Reference
In-Depth Information
The terms r i =
y i
f ( x i ) in Eq. (3.13) arecalled residuals ; theyrepresent the dis-
crepancybetween the datapoints and the fitting functionat x i . The function S to be
minimizedisthus the sum of the squares of the residuals.Equations(3.14) are gener-
allynonlinear in a j and may thus be difficult to solve. If the fitting functionis chosen
as a linear combination of specified functions f j ( x ):
f ( x )
=
a 1 f 1 ( x )
+
a 2 f 2 ( x )
+···+
a m f m ( x )
thenEqs. (3.14) arelinear. A typicalexample is apolynomialwhere f 1 ( x )
=
1, f 2 ( x )
=
x ,
x 2 , etc.
The spread of the dataabout the fitting curve isquantifiedbythe standard devi-
ation , definedas
f 3 ( x )
=
S
n
σ =
(3.15)
m
Note that if n
m , wehave interpolation , not curve fitting. In thatcase, both the
numerator and the denominatorinEq. (3.15) arezero, so that
=
σ
is meaningless, as it
shouldbe.
Fitting a Straight Line
Fitting a straight line
=
+
f ( x )
a
bx
(3.16)
to datais also known as linear regression . In thiscase the function to be minimizedis
n
bx i ) 2
,
=
( y i
S ( a
b )
a
i
=
1
Equations(3.14) nowbecome
2
x i
n
n
n
S
a =
1
2( y i
a
bx i )
=
y i +
na
+
b
=
0
i
=
i
=
1
i
=
1
2
n
n
n
n
S
x i
b =
1
2( y i
a
bx i ) x i =
x i y i +
a
x i +
b
=
0
i
=
i
=
1
i
=
1
i
=
1
Dividing both equations by 2 n and rearranging terms, we get
1
n
b
n
n
1
n
x i
a
+
xb
=
y x
+
=
x i y i
i
=
1
i
=
1
where
n
n
1
n
1
n
x
=
x i
y
=
y i
(3.17)
i
=
1
i
=
1
Search WWH ::




Custom Search