Ch. 9 Curve Fitting
Ch. 9 Curve Fitting
some suitable scale taking the values of x along r-axis and those ofy along y-axis. The clustering of these
points on the graph-paper is known as the Scatter diagram. A smooth curve is drawn through these points
in such a way that the plotted points remain closer to the curve as for as possible. Such a curve is know as
an approximation Curve. The mathematical equation of this curve connecting the various values of x and
y is known as the Empirical Equation.
The process of getting the curve based upon the equations thus obtained is Curve Fitting. The
constants involved while establishing the empirical relation between the variables are determined with the
help of well established mathematical techniques and theories. Some of the methods of curve fitting are as
under
() Graphic Method
i) Grouping of averages
(iin) Least square method
() Method of moments
We will do problems by least square method.
.()
y =a + bx + cx*+..... +kx"=f(r)
CSe values. Now, we have to determine constants a, b, c . . . . . . k such that it represents the curve of best fit
of that degree.
between 's, the
to the function. The error (or deviation)
Let
f x) be an approximation
shown in figure are either positive, zero or negative.
OXimation and y the actual tabulated values are as
281
SPECTRUM ENGINEERING MATHEM.
282 MATICSI
yS()
dn
i.e.
d2- 2-f(r,)
',Y,-S(7,)
The least square method states that "A curve is a best fit i.e. the curve of best fit if the sum ofsquares
of deviation between the actual vaBues of dependent variable (y,) and estimated values of dependen
"
F,) is minimum.
i.e. d+d+d +..d minimum
PH PM HM =
y, is called
or of estimate or the residual for y, and is denoted
error error
X
M
by e,i.e. e,Y,-(a +bx,)
According to the principle of least squares, we have to determine a and b so that
and
Oa
-220-a-bx,) =0
i=l
(2)
and -22, (y; -a-bx,) =0
i=l
y =na+bE2x ..(3)
and x y =a 2x+b 2x4
epresents the line of best fit to the given set of points (, y) ;i=1,2,. n.
24 3 3-6 4 6
y =
na +b 2x
xy= a Yx +b 2x
xy
2.4 2:4
2 3-1 6-0
36 10 8 9
4-0 16-0 16
5-0 30-0 36
8 6-0 48-0 64
2 3 5
1 5 11 14
+b
Let the linear curve be y
=
ax
FITTING AND RINCIPLE OF LEAST
CRVE
SQUARES
It Normal equations are given by 285
2y =a x+nb
2xy (2)
and =a 2x +b2x
.(3)
2
10
33
8
32 16
5
14
70 25
x - 15 y 39 2xy = 146 2 55
Put values of 2x, 2 y, 2xy and 2r in
(2) and (3) we get
15a+5b 39
55a + 15b - 146
...(4)
5)
Multiply (4) by (3) and subtracting from (5), we get
29
a
10
29
Put a
10
in (4), we get b=. T09
Put values of 'a' and 'b' in (1), we get
29 9
10 10
3 4 5
( 9 10
7 11
(P.T.U. 2014)
11 2 5 6-5
2 3 4
(P.T.U. 2015)
) Let the line be p= a +bx, where a and b are given by normal equations .(1)
2y=na +b2x
2
Zxy=a Er+b2x
286
SPECTRUM ENGINEERING MAT.
MATHEMAI
xy
7 14
9 27
10 40 16
55 25
141
xy 255
=
2x= 15 2y=42
1 5 a +55 b = 141
Multiplying (2) by 3 and (3) by 1, we get
15a+45 b=126
15 a+5b= 141
Subtracting (4) and (5), we get
10b 15 b= =
1-1 0 0 1 21
2 4
2 9
3 15 25
6-5 4 26 42 25
r = 17.6 y= 10 2 8146
2xy= 49
NG
C U R V EF I T T I N G , AND PRINCIPLE OF LEAST SQUARES
Therefore, we have 287
14 14 1
2 27 54 4
40 120 9
55 220 16
340 25
68
Therefore, we have
204 5 a+b (15) ..2)
Sa+ 15 b 204
and 748 a (15) + b (55) .(3)
1 5 a + 55 b 748
SPECTRUM ENGINE ERING MATHE
288
15 a +55b= 748
Subtracting (4) and (5), we get
136
10b 136 b= =
13 6
10
from (4),
5 a+ 204 =204 5 a=0 a=0
a 0,b= 13.6
Therefore, from (1) we have
y 0+(13-6)x
ie. y= 13 6x is the line of best fit.
Example 5. Given below are the figures of production (in thousand tonnes) of coal:
Year 1979 1981 1982 1983 1984 1985 1986
Production 70 85 94 83 90 100 98
(in thousand tonnes)
(a) Fit a straight line by the method of least squares and calculate the trend values.
(6) What is the monthly increase in the production of coal ?
Sol.
Year Production Origin 1983
(in tones)
Xy Trend Values
()
()
1979 70 -4 16 280 76561
1981 85 2 A 82-359
170
1982 94 94 85-258
1983 83 0 0 88-157
00
1984 90 91056
90
1985 100 4 93-955
200
1988 98 25 490 102652
N7 2Y 6200 2X =
1 X=51
Let the
XY =
236
straight line trend is given by
ya+ bx
The normal
equations are
y=na +b 2x
and xy =aEx +b2x
CURVE FITTING AND PRINCIPLE OF LEAST SQUAREs
289
Substituting the values
620 7 a +b
Sales: 77 88 94 85 91 98
5 25 385 81-33
1976 77 2:5
3 9 264 84 33
1977 88 - 1:5
-1 94 87-33
1978 94 -0:5
85 90-33
1979 85 0-5
9 273 93-33
1980 91 15
25 490 96-33
1981 98 2:5
2X 0 2X*= 70 2XY =105
2Y 533
SPECTRUM ENGINEERING MATHEMATIOSAL
Let the straight line trend be
Y =a+ b X
The nomal equations are
EY na+b 2X
and 2 XY=a 2X + b x?
Substitute the values
533 6 aa a 88-83
and 105 70 b b 15
the line of best fit is
Y =88-83+1:5X (Origin 1978 5, X unit =half ve=
100
(98)
98
(96
33)
96
(94) (93-33)
94
ORIGINAL VALUES
92 (90-33)
90 91)
88 ,"(88)
86 (87 33)
84 (85)
(84 33)
82
(81 33)
80 TREND LINE AND TREND VALUES
78
76
(77)
xo
CIRVE ITTING AND PRINCIPLE OF LEAST SQUARES
291
Example7 Show that the best fitting linear function for the points (1. y). (x,, y3), . . F,: Yn)
in the form
be
expressed na
Ex Eyn0i1,2,.. n
2 xy Ex
Show that the line passes through the mean point (f, F)
Col. Let the line of best fit be y=a+ bx
where a and b are constants to be determined from the normal
equation:
y na+ b2x,
2)
and xy a2x +bX*
.(3)
The line of best fit is obtained by eliminating a and b from equations (1), (2) and (3), we get
ie. 2yn 0
|2xy Er 2r2|
i.e.
x n-0 i=1,2,...n
Er y n
n =
00
E2xy Sx
Now consider
yy
- ,, n
x xy 2x
2 xy x|
0
ience the line passes through (F, )
9.3. Fitting of Second Degree Parabola
.(1)
Let Y=a+ bX +cX principle of
V);i=1,2,....n. Using the
be the ses fit to the set of n points (»
econd degree parabola of best
b and c so that
a,
ast constants
-a-bx, -ex**
i=l
minimum
derivatives of E w.r.t. a, and c should
b andcs
var
From the principle of maxima: and minima, the partial
separately, i.e.
nd CE 0
Oc
E y , = na+b2x, +cEx, 2
-2x, , -a-bx,-cx,")=0
Ob
x a Ex"+bEx +cZx,*
Equations (2), (3) and (4) are known as normal equations for estimating a, b and c.
and can be
All the quantities
i=l i =l i=l i=| i=l
obtained from the given set of points ( y,);i= 1,2,... n and using normal equations, we can find
values of a, b and c. For these values of a, b and c, equation (1) represent the best fit second deget
parabola to the given set of points (r,Y);i=1,2 . . . 7
X: 2 3 4
The 293
na'
estimating the value of
.
hYr* eX a h and c ate
8
1
18 18
13 4
16 2-6 5.2
25 9
27 81 7:5 22 5
63 16
64 25 2 100 8
256
2y 12.9
30 -10o -354 Ery-37-1 Eyy=130-3
Using Normal equations, we have
On
SPECTRUMENGINEERING MATHEMAT
THEMATIKI
putting c- - 0 011 in (8), we get
106+ 254
(0011) - 11:3
10b 14.099 h- 1 4094
On
putting c=- 0-011 and b- 1 4094 in (4). we e
Sa+ 10 (1
4094)+3-0-011) - 12:9
Sa-1161a-0-2322
the from (1). required equation of parabola is
-0-2322 +
(1 4094)x-0-011x
Example 9. Fit a degree parabola to the following data
:
second
3-0 3-5 4-0
2.0 25
-0 15
2-0 2.7 34 41
.1 1-3 16
be tabulated as under
Ol.On shifting the origin to the point x =
2:5, the given data can
X x X* XY xY
-2:5x-2Y- 9 27 81 -3-3 9-9
-0 - 1.5 -3
- 8 16 -2-6 5-2
-5 - 1-0 2 1-3 4
- 1:6 1-6
2-0 -0-5 - 1 16
0 0-0 0-0
2.0 0
2.5 0-0 0
2-7 1 2-7 2:7
3-0 0-5
8 16 68 13-6
3-5 1-0 2 3.4 4
9 27 27 12-3 36-9
4-0 15 3 4.1
EX =0 EY =16-2 2X* =28 x ' =02X = 196 2XY= 14.3 2XY =69-9
=207+2 (0 511)x-2.555 (0
0607) (4x2 -20 x+25)
+
Sol On shifting the scale to the point X the given data can be tabulated as follows:
x2 x XY xY
Y=y
3 07 3-07
3-07
8 16 25 70 51-4
12-85
81 94-41 283 23
31 47 9 27
64 256 229-52 918-08
57-38 16
125 625 456-45 2282 25
10 91-29 25
2152 8I
On subtracting(7) from (4), we get
60 b +374 c 1385.94
On multiplying (6) by 6, we get
60 b+360c= 1320-12
On
subtracting(9) from (8), we get
14 c 65 82 c =4.7014
On putting c =4-7014 in (6), we get
10b +60(4-7014) =220-02
10 b=- 62
064
b=- 6 2064
On putting b =-
6 2064 and c=4.7014 in (2), we get
5a+ 15-6-2064)+ 55 (4 7014) =
195.71
5a-93-096 +258 577 195-71
5 a 30.229 or a =6.0458
X 10 20 30 40 50
8 10 15 21 30
Sol. Let curve of best fit be given by
y =a+br ..(1)
Normal equations are given by
2y =na +b2x .. .(2)
and 2xy = a Ex +b E r
...)
CURVEFITTING AND PRINCIPLE OF LEAST SQU ARES 291
Given data is
8 1000
10 80 100
10 8000
20 200 400
27000
30 15
450 900
64000
40 21 840 1600
125000
Er - 150 2y = 84
3070 Er-5500
Put these values of 2r, 2y, Zy, 2r, Xr' in (2) and (3), we get
.(4)
69
a
10
from (1), required curve of best fit is given by
69 11
y- 10 1200
parabolic
from 1970 to 1976. Fit
a
Sol XY Trend
X X
Year Exports Origin Values
(Y) = 1973 (X)|
3 9 27 81 348 1044 19 82
1970 116
8 16 252 S04 112.51
4
1971 126
130 130 137 08
1972 130
0 0 193 53
0
1973 176
299 281 86
299
1974 299
1975 2
8 16 808 1616 402-07
404
1976 9 27 81 1650 4950 554-16
S50 3
N 7 2X =0 Ex' XY XY
2Y = 0 = 196
2027
= 8543
= 1801 28
29
SPECTRUM ENGINEERINGMATHEMaT
Let the
parabolic trend is represent by
Y =a bX+ cX
The normal
equations are
2Y na +h X+c X
XY N -AN x
and
xY -aYx 6yx' Xx'
Substituting the values we have
1801 7 a+ 28 c
2027 0+28 b +0 b = 72 39
Subtracting
84 c 1339
XUnit= 1 Year
= 137-08
For X=-1 Y1972 193 53 + 72-39 (-1) +15.94 (-1)
For X- 0, Y1973= 193 53 + 7239 (0) +15.94(0) = 193 53
In some determination of the volume v of carbon dioxide dissolved in a given volume of water a
3
different temperatures 6, the following pairs of values were obtained.
0 5 10 15
observations.
dissolve in 100 grams of
4 In the following table y is the weight of potassium bromide which will
water at temperature x. Find a linear law between x and y.
20 30 40 50 60 70
0 10
70 6 75-5 80 2 85-5 90
y gm 53-5 59.5 65 2
3 2 5 4
2 - 1 0 2
3
0 67 0-09 0-63 2 15
11.
4 63 2.11
ifV (km/hr.) and R (kg/tonne) are related by a relation of the type R = a t+ bVi, find by ther
4-58
11. by the metho
table:
of least squares, a and b with the help ofthe following
V: 10 20 30 40 50
R: 10 8 15 21 30
12. Fit a parabola y = a +br+cx to the following data
2 4 6 8 10
y: 3.07 12 85 91 29 31-47 57:38
13. The following table gives the results of the measurements of train resistances; V is the velocitv z
miles perhour. R is the resistance in pounds per ton:
V 20 40 60 80 100 120
R 5.5 9-1 14.9 22-8 33 3 46 0
IfR is related to V by the relation R =a+ bV + cV, find a, b and c
14. Fit a second degree parabola to the following data
2 3 4 5 6 7 8 9
y: 2 6 7 8 10 11 11 10
15. Fit a second degree parabola to the following data
x
2 3 5 6 8 9
y 6 7 8 10 11 11 10
(P.T.U. 201)
ANSWERS
1. P=2.2759 1879 W, P150 +0 30-4635 kg. 2. y= 13-6 (r)
3. v=
1:758-0-053 (0) 4. y- 54 35+ 5184 (x)
5. 15200 tons 6. y=1 6+ 38 (x)
7. Y- 004 (P) + 048 8. R 70 052 +0 292 ()
9. y=1:37 (x) +0 53 (x) 10. y= l-243 004 (x) +0 22 ()2
11. a=6 32, b 0 0095 =
12. y
13.
=0:34 0-78 x+0:99 r
R 3 48 002(V)+ 0029 V2 14. y-0-98x+3 55x-27
15. y-1-5223 +3847x-0-2997
ND
PRINCIPLE OF LEAST SQUARES 301
9.4 Fittingof Geometric Trend (y= ax
Let the
curve of
best fit is given by y= ax ..(1)
Taking log on both sides
logy=log a t b log x
or
y a + bX ; where Y log
=
y, ...(2)
a =
log a, X log X
=
y n a + b2X
or EXy«X+62X*
Solving these for a and b, we can find a and b and from (1), we get the required curve Or de
fit.
ILLUSTRATIVE EXAMPLES
Example 1. The voltage V across a capacitor at time t second is given by the following table. using "
4 8
150 63 28 12 5-6
kt .(1)
equations of the curve is v
=
ae
Sol. The
where Y =logiov, a
=
logio a, B=k logioe
Yt
Y = logio
0 0
150 2-1761
4 3 5956
1-7993
63 16 5 7888
A
14472
28 36 6.4752
1-0792
12 64 5.9856
8
0 7482
5.6 2r= 120 yt=21 8482
2 20
y = 7-25
2 y=na +ß2r
XY=a+82r
and
SPECTRUM ENGINEERING MATHEMAT
302
V= 146.4 4117
Let it be reduced to
logiox and ß =
b
=logio a, X
=
X = log1oX x XY
Y log10
0-0000 0-0000 0-0000
71 0-8513
0-3010 0-0906 0-4346
27-8 1-4440
0-2276 0-8555
1 7931 3 0-4771
62 1 0-3625 1:2291
2.0414 0-6021
110
0-4886 1 5425
2.2068 5 0.6990
161
EX = 2.0792 2 X - 1.1693 EXY =4-0618
|2Y=8.3366
AND
,
a ,= 8551
logio a 8551 * a=
A.L. (-8551) =a= 7.163
8-1-9532 b=1.9532
from (1) equation of the curve of best fit is
y-7 163 ()9532
Example 3.
You are given the ollowing population figures
2001
Census Year (X): 1941 1951 1961 1971 1981 1991
54 7
Population (Y) (in crores) 25-0 25 1 27-9 31.9 36.1 43 9
Fit the e x p o n e n t i a l t r e n d y = A B * t o t h e a b o v e d a t a b y m e t h o d o fl e a s t s q u a r e s .
The normal
equations are
2Y = n a+b 2X
and 2XY =
a EX + b EX*
304
A A.L. (1 5624)
A 33:6
From I1. og1o B 6178
=0-0578
28
B A.L. (0578) B 1 142
Thus the exponential trend becomes
Y (33-6)(1-142)
Origin 1914, X unit = Ten Years
EXERCISE 9 (b)
.Given below are the figures of production (in thousand tonnes) of coal
2 3 4
X .
40 55 68
14 27
y
from the data given below:
3. Fit a straight by the method of least squares
1979 1980 1981
1976 1977 1978
Year
85 91 98
77 88 94
Sales
goods from 1970 to 1976. Fit a parabolic trend
4. Given below are India's Exports of engineering
Y a +bX + cX^to the data.
1975 1976
1971 1972 1973 1974
Year 1970
299 404 550
I16-0 126-0 130 176
Exports Y (Rs. Cr.)
10 15 21
15 12
Cit a Curve o f t h e form y = ax to the data given below
4 5
2 3
7.1 110 161
y 27.8 62.1
ANSWERS
2. y 13-6x 3. Y 88 83 1 5X
1 Y 88157+2-899X 889
r 303
4Y = 193 100