Professional Documents
Culture Documents
Part (13) - Interpolation 1
Part (13) - Interpolation 1
Part (13) - Interpolation 1
Chapter 18
Interpolation
Eng. Mohammad Al Nairat & Eng. Mohammad Musleh
1
Introduction
Recall that the general formula for an nth-order polynomial is
For (𝑛 + 1) data points, there is one and only one polynomial of order 𝑛 that passes through all the
points.
Introduction
Many times, data is given only at discrete points
such as (x0, y0), (x1, y1), ......, (xn-1,
yn-1), (xn, yn).
So, how then does one find the value of y at any
other value of x ?
Spline Interpolation: Pass different curves through different subsets of the data
points.
Polynomial interpolation
Instead of using a single high order polynomial that passes through all data points,
we can use different lower order polynomials between each data pair.
These lower order polynomials that pass through only two points are called splines
a) Spline Interpolation Method
Given a set of ordered data points, each two points can be connected using a straight
line (two points are required).
a) Spline Interpolation Method
Example 1
Consider the following data to find 𝑓(50) using the linear spline interpolation.
𝑓 𝑥1 − 𝑓 𝑥0
𝑓 𝑥 = 𝑓 𝑥0 + . 𝑥 − 𝑥0 x y
𝑥1 − 𝑥0
40 2.5
𝑓 75 − 𝑓 40 75 11.5
𝑓 𝑥 = 𝑓 40 + . 𝑥 − 40
75 − 40
11.5 − 2.5
𝑓 𝑥 = 2.5 + . (𝑥 − 40)
75 − 40
11.5 − 2.5
𝑓 50 = 2.5 + . 50 − 40 = 5.071
75 − 40
Example 2
Consider the table given in the figure to calculate the saturated pressure at a
temperature T=107 ℃ using the linear spline interpolation.
𝑥0 = 105 and 𝑥1 = 110 ,choosing 100 and 110 will be less accurate.
𝑓 𝑥2 − 𝑓 𝑥1
𝑓 𝑥 = 𝑓 𝑥1 + . 𝑥 − 𝑥1
𝑥2 − 𝑥1
𝑓 110 − 𝑓 105
𝑓 𝑥 = 𝑓 105 + . 𝑥 − 105
110 − 105
143.38 − 120.9
𝑓 𝑥 = 120.9 + . (𝑥 − 105)
75 − 40
143.38−120.9
𝑓 107 = 120.9 + . 107 − 105 = 122.1845 kPa
75−40
b) Direct Method
The direct method of interpolation is based on the following premise: Given 𝑛 + 1 data
points, fit a polynomial of order 𝑛 as given below:
𝑦 = 𝑎𝑜 + 𝑎1 𝑥 + 𝑎2 𝑥 2 + ⋯ + 𝑎𝑛 𝑥 𝑛
The polynomial to be found is of the 1st order and requires two points to evaluate it.
𝑓 𝑥 = 𝑎0 + 𝑎1 𝑥 , so we write:
𝑓 3 = 𝑎0 + 𝑎1 3 = 6 X Y
3 6
𝑓 5 = 𝑎0 + 𝑎1 5 = 12
5 12
Now we have two equations:
𝑎0 + 𝑎1 3 = 6
Hence 𝑓 𝑥 = 𝑎0 + 𝑎1 𝑥 𝑓 𝑥 = −3 + 3𝑥
So, when 𝑦 = 4 , 𝑓 4 = −3 + 3 × 4 = 9
Example 2 (Quadratic Direct Method Interpolation)
Consider the following data which represent the velocity of a car at different time
instants. Using the direct method of a second order (quadratic) interpolation, find the
velocity of the car at time t=25 seconds.
time (s) velocity (m/s)
5 0
15 10
30 16
Example 2 - Solution
The polynomial to be found is of the 2nd order and requires three points to evaluate it.
𝑓 𝑥 = 𝑎0 + 𝑎1 𝑥 +𝑎2 𝑥 2 , so we write:
2
𝑓 5 = 𝑎0 + 𝑎1 5 +𝑎2 5 =2 time (s) velocity (m/s)
𝑓 15 = 𝑎0 + 𝑎1 15 +𝑎2 15 2 = 10
5 2
2
𝑓 30 = 𝑎0 + 𝑎1 30 +𝑎2 30 = 16
15 10
Now we have three equations:
𝑎0 + 5 𝑎1 + 25 𝑎2 = 2
30 16
𝑎0 + 15 𝑎1 +225 𝑎2 = 10
𝑎0 + 30 𝑎1 +900 𝑎2 = 16