Soluting the Normal Equations The normal equations may be an ill-conditioned linear system. The coefficients 4 and B for the least-squares line can be computed as follows.First compute the means and y,and then perform the calculations: C=立4-明,42x-0y-0B=-在 The algorithm aboved is computationally stable.It gives reliable results in cases when the normal equations are ill-conditioned
Soluting the Normal Equations ◼ The normal equations may be an ill-conditioned linear system. ◼ The coefficients A and B for the least-squares line can be computed as follows. First compute the means 𝑥ҧand 𝑦ത, and then perform the calculations: ◼ The algorithm aboved is computationally stable. It gives reliable results in cases when the normal equations are ill- conditioned. 2 1 1 1 ( ) , ( )( ), N N k k k k k C x x A x x y y B y Ax = = C = − = − − = −
Power Fit y=4xM ■ Some situations involve y=AxM,where Mis a known constant. In these cases there is only one parameter 4 to be determined. Thm.4.2 (Power Fit).Suppose that {(xk,y)=1 are N points, where the abscissas are distinct.The coefficient 4 of the least- squares power curve y=4xM is given by the following normal equation: 4区/会
Power Fit y=AxM ◼ Some situations involve y=AxM , where M is a known constant. In these cases there is only one parameter A to be determined. ◼ Thm. 4.2 (Power Fit). Suppose that {(𝑥𝑘, 𝑦𝑘)}𝑘=1 𝑁 are N points, where the abscissas are distinct. The coefficient A of the leastsquares power curve y=AxM is given by the following normal equation: 2 1 1 . N N M M k k k k k A x y x = = =
Methods of Curve Fitting ■ Suppose that we are given the points (),(x2),...,(x)and want to fit an exponential curve of the form y=Ce x The coefficients 4 and C should be determined. The nonlinear least-squares procedure requires that we find a minimum of E(A,C)=N=(CeAxk-yk)2.We set the partial derivatives of E(4,C)to zero and then simplified,the resulting normal equations are ce2-立e=0 -∑ye=0 k=1
Methods of Curve Fitting ◼ Suppose that we are given the points (x1 ,y1 ),(x2 ,y2 ),…,(xN,yN) and want to fit an exponential curve of the form y=CeAx . ◼ The coefficients A and C should be determined. ◼ The nonlinear least-squares procedure requires that we find a minimum of 𝐸 𝐴, 𝐶 = σ𝑘=1 𝑁 (𝐶𝑒 𝐴𝑥𝑘 − 𝑦𝑘) 2 . We set the partial derivatives of E(A, C) to zero and then simplified, the resulting normal equations are 2 1 1 2 1 1 0 0 k k k k N N Ax Ax k k k k k N N Ax Ax k k k C x e x y e C e y e = = = = − = − =
Data Linearization Method for y=Ce4x Take the logarithm of both sides:In(y)=Ax+In(C) Introduce the change of variables:Y=In(y),X=x,and B=In(C). A linear relation between the new variables X and Y:Y=4X+B The original points (in the xy-plane are transformed into the points (Y)(xkIn())in the XY-plane.This process is called data linearization.Then the least-squares line is fit to the points {(X Y) The normal equations for finding 4 and B are 2位xj-宫x 立x4+N8-24
Data Linearization Method for y=CeAx : ◼ Take the logarithm of both sides: ln(y)=Ax+ln(C). ◼ Introduce the change of variables: Y=ln(y), X=x, and B=ln(C). ◼ A linear relation between the new variables X and Y: Y=AX+B. The original points (xk ,yk ) in the xy-plane are transformed into the points (Xk ,Yk )=(xk ,ln(yk )) in the XY-plane. This process is called data linearization. Then the least-squares line is fit to the points {(Xk , Yk )}. The normal equations for finding A and B are 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 = = = = = + = + =
Transformations for Data Linearization The technique of data linearization has been used to fit curves. Once the curve has been chosen,a suitable transformation of the variables must be found so that a linear relation is obtained. Function,y=f(x) Linearized form,Y=4X+B Change of variable(s)and constants A y=x+B y=A+B X=,Y=y 0 X=xy,Y=y y= y=名)+ -1 x+C C= B =A 1 y= X=x,Y= Ax+B =Ax+B y y x 1 1 1 (c)y=Ax+B =A+B y X=Y=j
Transformations for Data Linearization ◼ The technique of data linearization has been used to fit curves. ◼ Once the curve has been chosen, a suitable transformation of the variables must be found so that a linear relation is obtained. Function, y = f (x) Linearized form, Y=AX+B Change of variable(s) and constants 𝑦 = 𝐴 𝑥 + 𝐵 𝑦 = 𝐴 1 𝑥 +B 𝑋 = 1 𝑥 , 𝑌 = 𝑦 𝑦 = 𝐷 𝑥 + 𝐶 𝑦 = −1 𝐶 𝑥𝑦 + 𝐷 𝐶 X = xy, Y = y 𝐶 = −1 𝐴 ,𝐷 = −𝐵 𝐴 𝑦 = 1 𝐴𝑥 + 𝐵 1 𝑦 = 𝐴𝑥 + 𝐵 𝑋 = 𝑥, 𝑌 = 1 𝑦 𝑦 = 𝑥 𝐴𝑥 + 𝐵 1 𝑦 = 𝐴 1 𝑥 + 𝐵 𝑋 = 1 𝑥 , 𝑌 = 1 𝑦 (c)