Graphics Programs Reference
In-Depth Information
EXAMPLE 3.9
Determine the parameters
a
and
b
so that
f
(
x
)
ae
bx
fits the following datainthe
=
least-squares sense.
x
1
.
2
2
.
8
4
.
3
5
.
4
6
.
8
7
.
9
.
.
.
.
.
.
y
7
5
16
1
38
9
67
0
146
6
266
2
Use two different methods: (1) fitln
y
i
; and (2) fitln
y
i
with weights
W
i
=
y
i
.Compute
the standard deviationineach case.
Solution of Part (1)
The problemistofit the function ln(
ae
bx
)
=
ln
a
+
bx
to the data
x
1
.
2
2
.
8
4
.
3
5
.
4
6
.
8
7
.
9
z
=
ln
y
2
.
015
2
.
779
3
.
661
4
.
205
4
.
988
5
.
584
We are nowdealing with linear regression, where the parameterstobefound are
A
ln
a
and
b
.Following the steps in Example 3.8, we get (skipping some of the
arithmetic details)
=
6
x
i
=
6
z
i
=
1
1
x
=
4
.
733
z
=
3
.
872
z
i
(
x
i
−
x
)
16
.
716
b
=
x
i
(
x
i
−
=
153
=
0
.
5366
A
=
z
−
xb
=
1
.
3323
x
)
31
.
e
A
790
e
0
.
5366
. The
Therefore,
a
=
=
3
.
790 and the fitting functionbecomes
f
(
x
)
=
3
.
plots of
f
(
x
) and the datapoints are shown in the figure.
300
250
200
150
y
100
50
0
1
2
3
4
5
6
7
8
x
Here is the computation of standard deviation:
y
7
.
50
16
.
10
38
.
90
67
.
00
146
.
60
266
.
20
f
(
x
)
7
.
21
17
.
02
38
.
07
68
.
69
145
.
60
262
.
72
−
.
−
.
.
−
.
.
.
y
f
(
x
)
0
29
0
92
0
83
1
69
1
00
3
48
Search WWH ::
Custom Search