Friday, July 4, 2014

Polynomial Curve Fitting

If you are asked to find a polynomial function of degree n-1 whose graph passes through specified points in a collection of data represented by n points in the xy-plane, then the procedure is called Polynomial Curve Fitting. To solve for the n coefficients of p(x), substitute each of the n points into the polynomial function and obtain n linear equations in n variables a0, a1, a2, ... , an-1
a0 + a1x1 + a2x12 + . . . an-1x1n-1 = y1
a0 + a1x2 + a2x22 + . . . an-1x2n-1 = y2
a0 + a1xn + a2xn2 + . . . an-1xnn-1 = yn

Example:
Determine the polynomial p(x) = a0+a1x+a2x2 whose graph passes through the points ( 2 ,8)  (4, 0)  (6,12).
Solution: Substituting x = 2, 4, and 6 into p(x) and equating the results to the respective y-values produces the system of linear equations in the variables a0, a1, a2 shown below.
p(2) = a0 + a1(2)  + a2(2)2 = a0 + 2a1 + 4a2 = 8
p(4) = a0 + a1(4)  + a2(4)2 = a0 + 4a1 + 16a2 = 0
p(6) =  a0 + a1(6)  + a2(6)2 = a0 + 6a1 + 36a2 = 12

[   1   2   4   8   ]
[   1   4  16  0   ]     -1(R1) + R2 ---> R2
[   1   6  36 12  ]

[   1   2    4     8  ]
[   0   2   12  -8   ]     1/2(R2) ---> R2
[   1   6   36  12  ]

[   1   2    4     8   ]
[   0   1    6    -4   ]     -1(R1) + R3 ---> R3
[   1   6   36   12  ]

[   1   2    4     8   ]
[   0   1    6    -4   ]     -4(R2) + R3 ---> R3
[   1   4   32    4   ]

[   1   2    4     8   ]
[   0   1    6    -4   ]      1/8(R3) ---> R3
[   0   0    8    20  ]
[   1   2    4     8   ]
[   0   1    6    -4   ]      -2(R2) + R1 ---> R1
[   0   0    1   5/2  ]

[   1   0   -8    16   ]
[   0   1    6    -4    ]       8(R3) + R1 ---> R1
[   0   0    1   5/2   ]

[   1   0    0    36   ]
[   0   1    6    -4    ]       -6(R3) + R2 ---> R2
[   0   0    1   5/2   ]

[   1   0    0     36 ]   ---> a0
[   0   1    0    -19 ]   ---> a1    
[   0   0    1    5/2 ]  ---> a2

Therefore,
p(x) = 5/2x2 –  19x + 36











No comments:

Post a Comment