Curve Fitting
Lecture 1
Dr. Sunil B. Chandak
Assistant Professor Mathematics
Science and Humanities Department, L.D. College of Engineering, Ahmedabad,Gujarat, India,
E-mail:- drsunilchandak@ldce.ac.in.
Subject : Probability and Statistics
Subject Code : 3130006
B. E. Third Semester 2020
June 24, 2020
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 1 / 18
Plan of the Presentation
1 Definition
2 Least Square Method
3 Fitting of Linear Curves
4 Examples of curve fitting of straight line
5 Problem on curve Fitting of straight line
6 Application
7 References
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 2 / 18
Definition
Introduction
Curve fitting: is the process of constructing a curve, or mathematical function,
that has the best fit to a series of data points, possibly subject to constraints.
It is a statistical technique use to derive coefficient values for equations that
express the value of one(dependent) variable as a function of another (inde-
pendent variable).
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 3 / 18
Least Square Method
Least Square Method
The sum of squares of residuals, denoted by E, is given by
Pn Pn
E = i=1 di2 = i=1 [yi − f (xi )]2
If E = 0 then all the n points will lie on y = f (x). If E 6= 0, f (x) is chosen
such that E is minimum,i.e. , the best fitting curve to the set of points is that foe
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.
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 4 / 18
Fitting of Linear Curves
Fitting of linear Curves
Let (xi , yi ) , i = 1, 2, ......n be the set of n values and let the relation between x
and y be y = a + bx.The constants a and b are selected such that the straight
line is the best fit to the data.
The residual at x = xi is
di = yi − f (xi )
= yi − (a + bxi ) i = 1, 2, ....., n
Pn
E = i=1 di2
n
X
E= (yi − a − bxi )2 (1)
i=1
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 5 / 18
Fitting of Linear Curves
Fitting of linear curves
For E to be minimum,
First
∂E
∂a =0
Pn
i=12(yi − a − bxi )(−1) = 0
Pn
i=1 (yi − a − bxi ) = 0
Pn Pn Pn
i=1 yi = a i=1 1 + b i=1 xi
X X
yi = na + b xi (2)
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 6 / 18
Fitting of Linear Curves
Fitting of linear curves
∂E
Second ∂b =0
Pn
i=1 2(yi − a − bxi )(−xi ) = 0
Pn
− axi − bxi2 ) = 0
i=1 (xi yi
Pn Pn Pn 2
i=1 xi yi = a i=1 xi + b i=1 xi
X X X
xi yi = a xi + b xi2 (3)
Equations (2) and (3) are known as Normal Equations.
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 7 / 18
Fitting of Linear Curves
Straight line y = a + bx
The Normal Equations of straight line y = a + bx are
P P
yi = na + b xi
xi yi = a xi + b xi2
P P P
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 8 / 18
Fitting of Linear Curves
Straight line y = ax + b
The Normal Equations of straight line y = ax + b are
P P
yi = a xi + nb
xi yi = a xi2 + b xi
P P P
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 9 / 18
Examples of curve fitting of straight line
Examples of curve fitting of straight line
Example
Fit a straight line to the following data.Also estimate the value of y at x = 2.5.
Table : 1.1.
x: 0 1 2 3 4
y: 1 1.8 3.3 4.5 6.3
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 10 / 18
Examples of curve fitting of straight line
Examples of curve fitting of straight line
Solution
Let the straight line to be fitted to the data be
y = a + bx
The Normal Equations are
X X
yi = na + b xi (4)
X X X
xi yi = a xi + b xi2 (5)
Here, n = 5
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 11 / 18
Examples of curve fitting of straight line
Examples of curve fitting of straight line
Solution
Table : 1.2.
x y x2 xy
0 1 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
P P P 2 P
x = 10 y = 16.9 x = 30 xy = 47.1
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 12 / 18
Examples of curve fitting of straight line
Examples of curve fitting of straight line
Solution
Substituting these values in equations (4) and (5)
16.9 = 5a + 10b (6)
47.1 = 10a + 30b (7)
Solving equations (6) and (7) we have
a = 0.72 and b = 1.33
Hence, the required equtaion of the straight line is
y = 0.72 + 1.33x
At x = 2.5,we have
y = 0.72 + 1.33(2.5) = 4.045
Hence complete the solution.
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 13 / 18
Problem on curve Fitting of straight line
Problem on curve Fitting of straight line
Problem
Fit the line of best fit to the following data :
x: 0 5 10 15 20 25
y: 12 15 17 22 24 30
Answer
y = 0.7x + 11.28
Problem
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
Answer
y = 0.0475 + 0.00407x
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 14 / 18
Problem on curve Fitting of straight line
Problem on curve Fitting of straight line
Problem
Fit the a straight line to the following data . Also, estimate the value of y at
x = 70.
x: 71 68 73 69 67 65 66 67
y: 69 72 70 70 68 67 68 64
Answer
y = 1.8182 + 0.4242x and y = 69.2424
Problem
Fit a straight line to the following data :
x: 15.3 1.78 2.60 2.95 3.42
y: 33.50 36.30 40.60 45.85 53.40
Answer
S B Chandak (L.D.College of Engineering) y= 19
Curve Fitting 9.7x
+(SBC) June 24, 2020 15 / 18
Application
Applications:
Understand the fitting of straight line by method of least square.
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 16 / 18
References
References
P.G Hoel,S.C. Port and C. J. Stone,Introduction to Probabiliy Theory Uni-
versal Book Stall.
M.Ray, H S Sharma and Sanjay Chaudhary,Mathematical Statistics,Ram
Prasad and Sons Educational Publishers.
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 17 / 18
THANKS ..
S B Chandak (L.D.College of Engineering) Curve Fitting (SBC) June 24, 2020 18 / 18