Page 18-61
As an
example
, use the following data to obtain a polynomial fitting with p =
2, 3, 4, 5, 6.
x y
2.30 179.72
3.20 562.30
4.50 1969.11
1.65 65.87
9.32 31220.89
1.18 32.81
6.24 6731.48
3.45 737.41
9.89 39248.46
1.22 33.45
Because we will be using the same x-y data for fitting polynomials of different
orders, it is advisable to save the lists of data values x and y into variables xx
and yy, respectively. This way, we will not have to type them all over again
in each application of the program POLY. Thus, proceed as follows:
{ 2.3 3.2 4.5 1.65 9.32 1.18 6.24 3.45 9.89 1.22 }
`
‘xx’
K
{179.72 562.30 1969.11 65.87 31220.89 32.81 6731.48 737.41
39248.46 33.45}
`
‘yy’
K
To fit the data to polynomials use the following:
@@xx@@
@@yy@@
2
@POLY
, Result: [4527.73 -3958.52 742.23]
i.e.,
y = 4527.73-39.58x+742.23x
2
@@xx@@
@@yy@@
3
@POLY
, Result: [ –998.05 1303.21 -505.27 79.23]
i.e.,
y = -998.05+1303.21x-505.27x
2
+79.23x
3
@@xx@@
@@yy@@
4
@POLY
, Result: [20.92 –2.61 –1.52 6.05 3.51 ]
i.e.,
y
= 20.92-2.61x-1.52x
2
+6.05x
3
+3.51x
4
.
@@xx@@
@@yy@@
5
@POLY
, Result: [19.08 0.18 –2.94 6.36 3.48 0.00 ]
i.e.,
y = 19.08+0.18x-2.94x
2
+6.36x
3
+3.48x
4
+0.0011x
5
@@xx@@
@@yy@@
6
@POLY
, Result: [-16.73 67.17 –48.69 21.11 1.07 0.19 0.00]
i.e.,
y = -16.73+67.17x-48.69x
2
+21.11x
3
+1.07x
4
+0.19x
5
+0.0058x
6