Numerical Computation - 10 - Interpolasi Spline
Numerical Computation - 10 - Interpolasi Spline
Bilinear Interpolation|Splines
2
Introduction to Splines
• we learn how to use (n-1)-th order polynomials to interpolate between n data points.
• For example, for eight points, we can derive a perfect seventh-order polynomial. This
curve would capture all the meanderings (at least up to and including seventh
derivatives) suggested by the points. However, there are cases where these functions can
lead to erroneous results because of round off error and oscillations.
• An alternative approach is to apply lower-order polynomials in a piecewise fashion to
subsets of data points. Such connecting polynomials are called spline functions.
• For example, third-order curves employed to connect each pair of data points are called
cubic splines.
• These functions can be constructed so that the connections between adjacent cubic
equations are visually smooth.
3
4
• Figure 18.1a through c illustrates how higher-order polynomials tend to swing
through wild oscillations in the vicinity of an abrupt change. In contrast, the spline
also connects the points, but because it is limited to lower-order changes, the
oscillations are kept to a minimum. As such, the spline usually provides a superior
approximation of the behavior of functions that have local, abrupt changes.
• The concept of the spline originated from the drafting technique of using a thin,
flexible strip (called a spline) to draw smooth curves through a set of points. The
process is depicted in Fig. 18.2 for a series of five pins (data points).
5
6
Linear Spline
7
Linear Spline
• In splines, for n data points (i=1, . . . ,n), there are n-1 intervals. Each interval i has
its own spline function si(x).
8
Linear Spline
• In the linear splines, for n data points (i=1, . . . ,n), there are n-1 intervals. Each
interval i has its own spline function si(x). Each function is the straight line
connecting two points at each end of the interval, formulated as
si ( x) = ai + bi ( x − xi )
• where ai=fi is the intercept and bi is the slope of the straight line connecting the
points, given as follows
f −f
bi = i +1 i
xi +1 − xi
13
Quadratic Spline
• To ensure that the nth derivatives are continuous at the knots, a spline of at least n + 1 order must be
used. Third-order polynomials or cubic splines that ensure continuous first and second derivatives are
most frequently used in practice.
• Because the derivation of cubic splines is somewhat involved, we have decided to first illustrate the
concept of spline interpolation using second-order polynomials.
• These “quadratic splines” have continuous first derivatives at the knots. Although quadratic splines
are not of practical importance, they serve nicely to demonstrate the general approach for developing
higher-order splines.
• The following equation represents the polynomial for each interval:
14
15
16
17
18
19
Cubic Splines
20
Cubic Splines
• As stated at the beginning of the previous section, cubic splines are most frequently
used in practice. The shortcomings of linear and quadratic splines have already been
discussed.
• Quartic or higher-order splines are not used because they tend to exhibit the
instabilities inherent in higher-order polynomials.
• Cubic splines are preferred because they provide the simplest representation that
exhibits the desired appearance of smoothness.
• The objective in cubic splines is to derive a third-order polynomial for each interval
between knots as represented generally by
21
• Thus, for n data points (i = 1, 2, . . . , n), there are n − 1 intervals and 4(n − 1)
unknown coefficients to evaluate.
• Consequently, 4(n − 1) conditions are required for their evaluation.
22
23
24
25
26
27
28
• The results of Examples 18.1 through 18.3 are summarized in Fig. 18.4. Notice the
progressive improvement of the fit as we move from linear to quadratic to cubic
splines.
• We have also superimposed a cubic interpolating polynomial on Fig. 18.4c.
• Although the cubic spline consists of a series of third-order curves, the resulting fit
differs from that obtained using the third-order polynomial. This is due to the fact
that the natural spline requires zero second derivatives at the end knots, whereas the
cubic polynomial has no such constraint.
29
30
31
32
Bilinear Interpolation
33
Multidimensional Interpolation
34
Bilinear
Interpolation
35
36
37