Lec8 Linear Interpolation
Lec8 Linear Interpolation
Lec8 Linear Interpolation
Dr. YA Hussain
Process Data
Concentration is measured through
some variable (X). Examples:
1. NaCl concentration is determined
by measuring conductivity (the
more NaCl the higher the
conductivity).
Conc.
Reactor 2. HCl concentration via titration
measurement
with NaOH
Calibration
2 Dr. YA Hussain
Calibration
Measure x for known values of the variable y.
Cond. Conc.
(S) (g/ml)
Make NaCl solutions by mixing
0.3 1.0
100 ml of water with:
0.7 2.0
1. 1.0 g NaCl
NaCl 2. 2.0 g NaCl 1.2 3.0
NaCl
Soln
soln 3. 3.0 g NaCl 1.8 4.0
4. 4.0 g NaCl
Measure conductivity of each
solution
x = 3.3
By interpolation
Conc.
Or extrapolation Reactor measurement
3 Dr. YA Hussain
Interpolation/Extrapolation
Draw a line through data
2
Cond. Conc.
Find the conc.
(S) (g/ml)
when the cond.
0.3 1.0 1.5 equals 2.5 S.
Conc.
0.7 2.0
1.2 3.0
1
1.8 4.0
0.5
Why do we put conc.
on the y axis and
cond. on the x axis? 0
0 2 4
Cond.
4 Dr. YA Hussain
Two-Point Linear Interpolation
14 (x2,y2)
12
10 (x,y)
8
y
6
(5,5)
(x1,y1)
4 (4,3.2) y y1 y 2 y1
2 x x1 x 2 x1
0
0 5 10 y 2 y1
x y (x x1 ) y1
Find y at x = 4.5? x 2 x1
5 Dr. YA Hussain
Example: Two-Point Interpolation
The variable f is y 2 y1
measured at several y (x x1 ) y1
times x 2 x1
f t 4 1
f (1.3 1) 1 1.9
1 1 2 1
t = 1.3
4 2
f= 5
8 3 32
t (3 2) 2 2.25
84
Find: f(t = 1.3), t(f = 5)?
6 Dr. YA Hussain
Fitting a Straight Line
12
x y Choose any y1 = ax1 + b
two points (x2,y2)
1 1 10
on the line
4 2 8
8 3 y1 y2
6 a=
y
10 4 x1 x2
4 (x1,y1)
y2 = ax2 + b
y1 ax1
Try to write an equation: b=
2 y2 ax2
y = f(x)
0
Simplest function 0 1 2 3 4 5
y = ax + b x
7 Dr. YA Hussain
Example: Linear Fit
160
160
V
R 140
140
(L/min)
20.0 10 120
120
52.1 30 100
100
V (L/min)
84.6 50 8080
118.3 70 6060
151.0 90 V (L/min) = 1.62R + 3.8
4040
V: volumetric flow rate
R: rotameter reading 2020
00
Find V(R) and V(36)? 00 20
20 40
40 60
R 60 80
80 100
100
8 Dr. YA Hussain
Two-Point vs. Linear Fitting
9 Dr. YA Hussain
Summary
Calibration is used to related measured quantities with
desired variables (e.g., conductivity with salt
concentration, voltage with temperature)
Interpolation and extrapolation are methods used to
determine the desired variable from tabulated
measurements.
Drawing a straight line through the data is the simplest
form of interpolation and works well for linear data.
Two-point linear interpolation can be used with large
amounts of data and when the data is not linear.
Two-point linear interpolation is generally more accurate
that drawing a straight line.
10 Dr. YA Hussain
Reading assignment:
Sections 2.7-2.7b in textbook
Practice Problems:
30 to 44 in Chapter 2 of textbook
11 Dr. YA Hussain