205
Xnumbers Tutorial
197
Interpolation schemas
If the number N of the points (x, y) is exactly equal to degree+1, then the polynomial is
univocally determined; but if N > degree+1 there are several different polynomials that can be
used for interpolating a given point x. A popular method, adopted by the function PolyInterp is
called "sliding centered polynomial"
Linear interpolation
The linear interpolation is always performed between the nodes x
i
x
i+1
where x ∈[x
i
x
i+1
]
For degree > 1 the interpolation strategy is more complicated.
Odd degree polynomial (example degree = 3)
The 3
rd
degree interpolation is performed between the nodes {x
i-1
x
i
, x
i+1
, x
i+2
} where
x ∈[x
i
, x
i+1
]. At the first of the segment, the interpolation is performed between the nodes
{x
1
, x
2
, x
3
, x
4
} where x ∈[x
1
, x
3
]. At the end, the interpolation is performed between the
nodes { x
N-3
, x
N-2
, x
N-1
, x
N
} where x ∈[x
N-2
, x
N
].
Even degree polynomial (example degree = 2)
The 2
rd
degree interpolation is performed between the nodes {x
i-1
x
i
, x
i+1
} and { x
i
, x
i+1
, x
i+2
}
where x ∈[x
i
, x
i+1
]. The first set gives the left interpolation polynomial while the second set
gives the right interpolation polynomial. In the range x ∈[x
i
, x
i+1
] the final interpolation is
obtained taking the average of the two polynomials. At the first of the segment, the interpolation
is performed between the nodes {x
1
, x
2
, x
3
} where x ∈[x
1
, x
2
]. At the end, the interpolation is
performed between the nodes { x
N-2
, x
N-1
, x
N
} where x ∈[x
N-1
, x
N
].
The average interpolation schemas adopted for even degree polynomials can often increase
the gloabal accuracy but, on the other hand, it reduces the efficence.
This example helps to explain this trick.
Assume to have the data set composed by 4
points; we want to perform the parabolic
interpolation of a point y(x) where
0.6
≤ x ≤
1
and y(
0.6
) = y
2
and y(
1
) = y
3
i
x
y
1
0.2
0.163746
2
0.6
0.329287
3
1
0.367879
4
1.4
0.345236
Note that the given points belong to the function
x
xe
y x
−
=
( )
x
i
, x
i+1
x
i-1
x
i
, x
i+1
,
Left polynomial
x
N-2
, x
N-1
, x
N
x
1
, x
2
, x
3
x
i
, x
i+1
, x
i+2
Right polynomial
average interpolation
x
i-1
x
i
, x
i+1
, x
i+2
x
N-3
, x
N-2
, x
N-1
, x
N
x
1
, x
2
, x
3
, x
4