CURVE FITTING
WHAT IS CURVE FITTING?
Curve fitting is the process of finding the best- fit curve for a given set of data. The relationship between two variables is represented by means of an algebraic equation.
Suppose a set of n points of values (x1, y1), (x2, y2), …, (xn , yn) of the two variables x and y are given.
These values are plotted on the xy-plane.
Figure (i): Scatter Diagram
The resulting set of points is known as a scatter diagram as shown in figure (i).
The scatter diagram exhibits the trend and it is possible to visualize a smooth curve approximating the data which is known as an approximating curve.
LEAST SQUARE METHOD
From a scatter diagram, generally, more than one curve may be seen to be appropriate to the given set of data.
Let P (xi, yi) be a point on the scatter diagram as shown in figure (ii).
Distance QP = MP-MQ
= yi – f(xi)
The distance QP is known as deviation, error, or residual and is denoted by di.
If E= 0 then all the n points will lie on y = f(x). If E ≠ 0, f(x) is chosen such that E is minimum, i.e., the best fitting curve to the set of points is that for which E is minimum.
This method is known as the least square method.
This method does not attempt to determine the form of the curve y = f(x) but it determines the values of the parameters of the equation of the curve.
FITTING OF LINEAR CURVES
The normal equations for the straight line y = a + bx are
∑y = na + b∑x
∑xy = a∑x + b∑x2
These equations can be solved simultaneously to give the best values of a and b.
The best fitting straight line is obtained by substituting the values of a and b in the equation y = a + bx.
Question:
Fit a straight line to the following data:
x |
100 |
120 |
140 |
160 |
180 |
200 |
y |
0.45 |
0.55 |
0.60 |
0.70 |
0.80 |
0.85 |
Solution:
Let the straight line be fitted to the data be
y = a + bx
The normal equations are
∑y = na + b∑x
∑xy = a∑x + b∑x2
X |
y |
x2 |
xy |
100 |
0.45 |
10000 |
45 |
120 |
0.55 |
14400 |
66 |
140 |
0.60 |
19600 |
84 |
160 |
0.70 |
25600 |
112 |
180 |
0.80 |
32400 |
144 |
200 |
0.85 |
40000 |
170 |
∑x = 900 |
∑y = 3.95 |
∑x2 = 142000 |
∑xy = 621 |
Substituting these values in normal equations
3.95 = 6a + 900b …(i)
621 = 900a + 14200b …(ii)
Solving equations (i) and (ii),
a = 0.0476 and b = 0.0041
Hence, the required equation of the straight line is
y = 0.0476 + 0.0041x
HOW TO FIND THE REQUIRED EQUATION OF STRAIGHT LINE USING fx82MS CALCULATOR:
FITTING OF QUADRATIC CURVES
The normal equations for the curve y = a+bx+cx² are
∑y = na + b∑x + c∑x2
∑xy = a∑x + b∑ x2 + c∑x3
∑x2y = a∑x2+ b∑x3 + c∑x4
These equations can be solved simultaneously to give the best values of a, b, and c.
The best fitting parabola is obtained by substituting the values of a, b, and c in the equation y = a+bx+cx².
Question:
Fit a parabola to the following data:
x |
1 |
2 |
3 |
4 |
5 |
y |
5 |
12 |
26 |
60 |
97 |
Solution:
Let the equation of the parabola be a+bx+cx²
The normal equations are
∑y = na + b∑x + c∑x2
∑xy = a∑x + b∑ x2 + c∑x3
∑x2y = a∑x2+ b∑x3 + c∑x4
Here n = 5,
X |
y |
x2 |
x3 |
x4 |
xy |
x2y |
1 |
5 |
1 |
1 |
1 |
5 |
5 |
2 |
12 |
4 |
8 |
16 |
24 |
48 |
3 |
26 |
9 |
27 |
81 |
78 |
234 |
4 |
60 |
16 |
64 |
256 |
240 |
960 |
5 |
97 |
25 |
125 |
625 |
485 |
2425 |
∑x = 15 |
∑y = 200 |
∑x2 = 55 |
∑x3 = 225 |
∑x4 = 979 |
∑xy = 832 |
∑x2y = 3672 |
Substituting these values in the normal equations,
200 = 5a + 15b + 55c …(i)
832 = 15a + 55b + 225c …(ii)
3672 = 55a + 225b + 979c …(iii)
Solving equations (i), (ii) and (iii) we get
a = 10.4, b = -11.0857 and c = 5.7143
Hence, the required equation of the parabola is
y = 10.4 – 11.0857x + 5.7143x2
HOW TO FIND THE REQUIRED EQUATION OF PARABOLA USING fx82MS CALCULATOR:
FITTING OF EXPONENTIAL AND LOGARITHMIC CURVES
For the curve y = abx
Taking Logarithm on both sides of the equation y = abx,
logey = logea + xlogeb
Putting logey = Y, logea = A, logeb = B
Y = A + BX
The normal equations are
∑Y = nA + B∑X
∑XY = a∑X + b∑X2
Solving these equations, A and B, and, hence, a and b can be found.
The best fitting exponential curve is obtained by substituting the values of a and b in the equation y = abx.
Question:
Fit a curve of the form y = abx to the following data by the method of least squares:
x |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
y |
87 |
97 |
113 |
129 |
202 |
195 |
193 |
Solution:
y = abx
Taking Logarithm on both sides of the equation y = abx,
logey = logea + xlogeb
Putting logey = Y, logea = A, logeb = B
Y = A + BX
The normal equations are
∑Y = nA + B∑X
∑XY = a∑X + b∑X2
Here n = 7,
x |
Y |
X |
Y |
X2 |
XY |
1 |
87 |
1 |
4.4659 |
1 |
4.4659 |
2 |
97 |
2 |
4.5747 |
4 |
9.1494 |
3 |
113 |
3 |
4.7274 |
9 |
14.1822 |
4 |
129 |
4 |
4.8598 |
16 |
19.4392 |
5 |
202 |
5 |
5.3083 |
25 |
26.5415 |
6 |
195 |
6 |
5.2730 |
36 |
31.6380 |
7 |
193 |
7 |
5.2627 |
49 |
36.8389 |
|
|
∑X = 28 |
∑Y = 34.4718 |
∑X2 = 140 |
∑XY = 142.2551 |
34.4718 = 7A + 28B … (i)
142.2551 = 28A + 140B … (ii)
Solving equations (i) and (ii),
A = 4.3006 and B = 0.156
logea = A
logea = 4.3006
a = 73.744
logeb = B
logeb = 0.156
b = 1.1688