Least Squares Fit to a Polynomial Equation


Consider a set of data [ y 1 , y 2 , ..., y N ] taken at discrete points [ x 1 , x 2 , ..., x N ]. The data might be beam displacement as a function of load factor, specific heat as a function of temperature, or any other data you might wish to consider. Now let us assume that we want to define a straight line, a first-order polynomial expression, through the data.

Equation 24.1

graphics/24equ01.gif


If we apply Eq. (24.1) to each data point in our collection of data, we obtain the following matrix equation.

Equation 24.2

graphics/24equ02.gif


We will also refer to Eq. (24.2) by the shorthand notation, Ac = y . If there is any scatter to the data, the left-hand side of Eq. (24.2) will not equal the right hand side. There will be a difference, or error, between the computed value of y i and the actual data point value. At any point the error is equal to Eq. (24.3).

Equation 24.3

graphics/24equ03.gif


The total error of the system can be estimated by summing the square of the error at each individual point, as in Eq. (24.4).

Equation 24.4

graphics/24equ04.gif


One way to find a best fit to the data is to compute the coefficients c and c 1 such that the total error of the system is minimized. This is known as a least squares fit to a collection of data. It turns out that the least square coefficients can be determined by multiplying the transpose of the A matrix to the left and right hand sides of Eq. (24.2). The result is Eq. (24.5).

Equation 24.5

graphics/24equ05.gif


If the left and right-hand sides of Eq. (24.2) are multiplied by A T you obtain the following matrix equation.

Equation 24.6

graphics/24equ06.gif


When the system of equations shown in Eq. (24.6) is solved , the coefficients vector, [ c 1 , c o ], will contain the least squares fit coefficients.

The least squares fit procedure can be applied to any polynomial expression. The contents and size of the arrays A T A and A T y will depend on the type of equation used. The number of columns and/or rows of the arrays A T A and A T y will be equal to the order of the polynomial equation used for the data fit plus one. Consider the case of the general polynomial expression shown in Eq. (24.7).

Equation 24.7

graphics/24equ07.gif


In Eq. (24.7) the order of the equation is M . The array A T A will be an ( M + 1) x ( M + 1) array shown in Eq. (24.8).

Equation 24.8

graphics/24equ08.gif


The A T y vector for the general polynomial shown in Eq. (24.7) is shown in Eq. (24.9).

Equation 24.9

graphics/24equ09.gif




Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net