Polynomial fitting – HP 49g+ User Manual
Page 625
Page 18-58
You should have in your calculator’s stack the value of the matrix X and the
vector b, the fitted values of y are obtained from
y = X⋅b, thus, just press *
to obtain: [5.63.., 8.25.., 5.03.., 8.23.., 9.45..].
Compare these fitted values with the original data as shown in the table
below:
x
1
x
2
x
3
y y-fitted
1.20 3.10 2.00 5.70 5.63
2.50 3.10 2.50 8.20 8.25
3.50 4.50 2.50 5.00 5.03
4.00 4.50 3.00 8.20 8.23
6.00 5.00 3.50 9.50 9.45
Polynomial fitting
Consider the x-y data set {(x
1
,y
1
), (x
2
,y
2
), …, (x
n
,y
n
)}. Suppose that we want
to fit a polynomial or order p to this data set. In other words, we seek a fitting
of the form y = b
0
+ b
1
⋅x + b
2
⋅x
2
+ b
3
⋅x
3
+ … + b
p
⋅x
p
. You can obtain the
least-square approximation to the values of the coefficients
b = [b
0
b
1
b
2
b
3
… b
p
], by putting together the matrix
X
_
_
1
x
1
x
1
2
x
1
3
… x
1
p-1
y
1
p
1
x
2
x
2
2
x
2
3
… x
2
p-1
y
2
p
1
x
3
x
3
2
x
3
3
… x
3
p-1
y
3
p
. . . .
. .
. . . . . . .
1
x
n
x
n
2
x
n
3
… x
n
p-1
y
n
p
_
_
Then, the vector of coefficients is obtained from
b = (X
T
⋅X)
-1
⋅X
T
⋅y, where y is
the vector
y = [y
1
y
2
… y
n
]
T
.
In Chapter 10, we defined the Vandermonde matrix corresponding to a
vector
x = [x
1
x
2
… x
m
] . The Vandermonde matrix is similar to the matrix
X
of interest to the polynomial fitting, but having only n, rather than (p+1)
columns.
We can take advantage of the VANDERMONDE function to create the matrix
X if we observe the following rules: