Chapter 4. Curve Fitting
Chapter 4. Curve Fitting
Curve Fitting Application of numerical techniques in science and engineering often involve curve fitting of experimental data. In science and engineering it is often the case that an experiment produces a set of data points (x),...(xNN),where the abscissas {x are distinct.If all the numerical values {x),v}are known to several significant digits of accuracy,then polynomial interpolation can be used successfully;otherwise,it cannot. However,many experiments are done with equipment that is reliable only to three or fewer digits of accuracy.Often,there is an experimental error in the measurements. How do we find the best approximation that goes near(not always through)the points?
Curve Fitting ◼ Application of numerical techniques in science and engineering often involve curve fitting of experimental data. ◼ In science and engineering it is often the case that an experiment produces a set of data points (x1 ,y1 ),…,(xN,yN), where the abscissas {xk} are distinct. If all the numerical values {xk}, {yk} are known to several significant digits of accuracy, then polynomial interpolation can be used successfully; otherwise, it cannot. ◼ However, many experiments are done with equipment that is reliable only to three or fewer digits of accuracy. Often, there is an experimental error in the measurements. ◼ How do we find the best approximation that goes near (not always through) the points?
Measures for Errors (Deviations or Residuals) ■Denote efx)yk for 1≤kW ■Maximum error: E.()=mlf()-y.B ■Average error: EUDN24l k1 Root-mean-square error: a=哈2-月
Measures for Errors (Deviations or Residuals) ◼ Denote ek=f(xk )-yk for 1≤k≤N ◼ Maximum error: ◼ Average error: ◼ Root-mean-square error: 1 1 1 1 2 2 2 1 ( ) max{| ( ) |} 1 ( ) | ( ) | 1 ( ) | ( ) | k k k N N k k k N k k k E f f x y E f f x y N E f f x y N = = = − = − = −
Finding the Least-Squares Curve Let {be a set of N points,where the abscissas are distinct.The least-squares curve yfx)is the best one in some function class that minimizes the root-mean-square error E2(f). The simplest formula is the line y-fx)=Ax+B. The quantity E2(f)will be a minimum if and only if the quantity (E((+B-)is a minimum The latter is visualized geometrically by minimizing the sum of the squares of the vertical distances from the points to the line
Finding the Least-Squares Curve ◼ Let {(𝑥𝑘, 𝑦𝑘)}𝑘=1 𝑁 be a set of N points, where the abscissas {xk} are distinct. The least-squares curve y=f(x) is the best one in some function class that minimizes the root-mean-square error E2 (f ). ◼ The simplest formula is the line y=f(x)=Ax+B. ◼ The quantity E2 (f ) will be a minimum if and only if the quantity is a minimum. ◼ The latter is visualized geometrically by minimizing the sum of the squares of the vertical distances from the points to the line. 2 2 2 1 ( ( )) ( ) N k k k N E f Ax B y = = + −
The Least-Squares Line Thm.4.1(Least-Squares Line).Suppose that {(xk,y=1are N points, where the abscissas1are distinct.The coefficients of the least- squares line y=Ax+B are the solution to the following linear system, known as the normal equations: 位4+位-2 位+阳-2 The line y=fx)=Ax+B is the line that minimizes the root-mean-square error E2(f)
The Least-Squares Line ◼ Thm. 4.1(Least-Squares Line). Suppose that {(𝑥𝑘, 𝑦𝑘)}𝑘=1 𝑁 are N points, where the abscissas {xk}𝑘=1 𝑁 are distinct. The coefficients of the leastsquares line y=Ax+B are the solution to the following linear system, known as the normal equations: ◼ The line y=f(x)=Ax+B is the line that minimizes the root-mean-square error E2 (f ). 2 1 1 1 1 1 N N N k k k k k k k N N k k k k x A x B x y x A NB y = = = = = + = + =