Page 144 - Applied Numerical Methods Using MATLAB
P. 144

INTERPOLATION BY CUBIC SPLINE  133
            With these coefficients, we write the Pade approximate function as

                                                          2
                               Q 3 (x)  1 + (3/5)x + (3/20)x + (1/60)x 3
                      p 3,2 (x) =    =
                               D 2 (x)     1 + (−2/5)x + (1/20)x 2
                                          2
                                    3
                               (1/3)x + 3x + 12x + 20
                            =                                           (E3.2.5)
                                     2
                                    x − 8x + 20
            3.5  INTERPOLATION BY CUBIC SPLINE
            If we use the Lagrange/Newton polynomial to interpolate a given set of N + 1
            data points, the polynomial is usually of degree N and so has N − 1 local extrema
            (maxima/minima). Thus, it will show a wild swing/oscillation (called ‘polynomial
            wiggle’), particularly near the ends of the whole interval as the number of data
            points increases and so the degree of the polynomial gets higher, as illustrated
            in Fig. 3.2. Then, how about a piecewise-linear approach, like assigning the
            individual approximate polynomial to every subinterval between data points?
            How about just a linear interpolation—that is, connecting the data points by
            a straight line? It is so simple, but too short of smoothness. Even with the
            second-degree polynomial, the piecewise-quadratic curve is not smooth enough
            to please our eyes, since the second-order derivatives of quadratic polynomials
            for adjacent subintervals can’t be made to conform with each other. In real
            life, there are many cases where the continuity of second-order derivatives is
            desirable. For example, it is very important to ensure the smoothness up to order 2
            for interpolation needed in CAD (computer-aided design)/CAM (computer-aided
            manufacturing), computer graphic, and robot path/trajectory planning. That’s why
            we often resort to the piecewise-cubic curve constructed by the individual third-
            degree polynomials assigned to each subinterval, which is called the cubic spline
            interpolation. (A spline is a kind of template that architects use to draw a smooth
            curve between two points.)
              For a given set of data points {(x k ,y k ), k = 0: N}, the cubic spline s(x)
            consists of N cubic polynomial s k (x)’s assigned to each subinterval satisfying
            the following constraints (S0)–(S4).

                                          3             2
              (S0) s(x) = s k (x) = S k,3 (x − x k ) + S k,2 (x − x k ) + S k,1 (x − x k ) + S k,0
                   for x ∈ [x k ,x k+1 ],k = 0: N
              (S1) s k (x k ) = S k,0 = y k for k = 0: N
              (S2) s k−1 (x k ) ≡ s k (x k ) = S k,0 = y k for k = 1: N − 1
              (S3) s    (x k ) ≡ s (x k ) = S k,1 for k = 1: N − 1

                    k−1      k

              (S4) s     (x k ) ≡ s (x k ) = 2S k,2 for k = 1: N − 1
                    k−1      k
              These constraints (S1)–(S4) amount to a set of N + 1 + 3(N − 1) = 4N − 2
            linear equations having 4N coefficients of the N cubic polynomials
                              {S k,0 ,S k,1 ,S k,2 ,S k,3 ,k = 0: N − 1}
   139   140   141   142   143   144   145   146   147   148   149