| 1. |
Explain the method of fitting a straight line of the form y=a+bx to a novitiate data |
|
Answer» Step-by-step explanation: The graphical method has the drawback in that the straight line drawn may not be unique but principle of least squares PROVIDES a unique set of values to the constants and hence suggests a curve of best fit to the given data. The method of least square is probably the most systematic procedure to fit a unique curve through the given data points. We will consider some of the best fitting curves of the type: 1. A straight line. 2. A second degree curve. 3. The exponential curve y = aebx. 4. The curve y — a x 71. 1. Fitting a straight line by the method of least squares: Let (x;,yj), t = 0,1,2,....,n be the n sets of observations and let the related relation by y = ax + b. Now we have to select a and b so that the straight line is the best fit to the data. As explained earlier, the residual at x = x t is d i= y i~ f O i) = yt~ Caxi + b),i = 1,2,, 71 e = ir= i df = Xf=i [yf - (axi + b)]2 By the principle of least squares, E is minimum. AL-Mustansirriya University College oE Engineering Computer & Software ENG. Dep. AiL^I Course ( l) Lecture (4) 3rd Class dE dE — = 0 and — = 0 da db i-e-, 2 - (axt + b)] ( - ^ ) = 0 & 2 £ [y £ - (axt + b)] ( - 1 ) = 0 i.e., - ax? - bXi) = 0 & E?=i(yi - ax< - ft) = 0 i.e., aZ?=i3C? = Z " = i^ y i .... (eq.l) And a £"=1 x t + nb = £ f=1 y; .....(eq.2) Since, x it y t are known, equations (1) & (2) give two equations in a & b. Solve for a & b from (1) & (2) & obtain the best fit y= ax + b. Note: • Equations (1) & (2) are called normal equations. • Dropping SUFFIX i from (1) & (2), the normal equations are aY ,x + nb = £ y & a£x2 + b j ^ x = £xy Which are get taking £ on both sides of y = ax + b & also taking £ on both sides after multiplying by x both sides of y = ax + b. • Transformation like X = ~ ~ , Y — ~ ~ reduce the linear equation y = ax + b to the form Y = AX + B. Hence, a linear fit is another linear fit in both SYSTEMS of coordinates. Example 1: By the method of least squares find the straight line to the data given below: X 5 10 15 20 25 y 16 19 23 26 30 Solution: Let the straight line be y=ax+b The nor AL-Mustansirriya University College of Engineering Computer & Software Eng. Dep. Course ( l) Lecture (4) 3rd Class X y X 2 xy 5 16 25 80 10 19 100 190 15 23 225 345 20 26 400 520 25 30 625 750 Total 75 114 1375 1885 The normal equations are 75a+5b=l 14 .....(eq.l) 1375a+75b=1885 ..... (eq.2) Eliminate b, multiply (1) by 15 1125a+75b=1710 .....(eq.3) (eq.2) - (eq.3) gives, 250 a=T75 or a=0.7, hence b= 1 ? ^ Hence, the best fitting line is y=0.7x+12.3 Let X = x~xmid = *~15 y = y~ymid = y~23 h 5 ’ h 5 Let the line in the new variable by Y=AX+B X y X X2 Y XY 5 16 -2 4 -1.4 2.8 10 19 -1 1 -0.8 0.8 15 23 0 0 0 0 20 26 1 1 0.6 0.6 25 30 2 4 1.4 2.8 Total 0 10 -0.2 7 The normal equations are A £ X + 55 = £ Y .....(eq.4) A Y X 2 + B Y , X = Z X Y .....(eq.5) Therefore, -SB = —0.2 —> B = —0.04 10A = 7 ->A = 0.7 The equations Y=0.7X - 0.04 i.e. = 0.7 ( - 0.04 y - 23 = 0.7x - 10.5 - 0.2 i.e. y=0.7x+33.3 Which is the same equation as seen before. -----------------------------------------------------------------------------------page 3 ---------------- -----— AL-Mustansirriya University College of Engineering Computer & Software Eng. Dep. ■Miami Course ( l) Lecture (4) 3rd Class Example 2: Fit a straight line to the data given below. Also estimate the value of y at x=2.5 x 0 l 2 3 4 y l 1.8 3.3 4.5 6.3 Solution: Let the best fit be y= ax + b .....(eq.l) The normal equations are a £ x + 5b = £ y .....(eq.2) a£x2 + b'Zx = 2 > y .....(eq.3) We prepare the table for easy use. X y X 2 xy 0 l 0 0 1 1.8 1 1.8 2 3.3 4 6.6 3 4.5 9 13.5 4 6.3 16 25.2 Total 10 16.9 30 47.1 Substituting in (eq.2) and (eq.3), we get, 10a+5b=16.9 30a+10b=47.1 Solving eq.(2)-eq.(l), we get, a=l .33, b= 0.72 Hence, the equation is y =1.33x+0.72 y (at x=2.5) =1.33 (2.5) +0.72 = 4.045 |
|