Page 173 - Applied Numerical Methods Using MATLAB
P. 173

162    INTERPOLATION AND CURVE FITTING
                (a) The above routine “rational_interpolation(x,y,xi)”uses the
                   Bulirsch–Stoer method to interpolate the set of data pairs (x,y)given
                   as its first/second input arguments over a set of intermediate points
                   xi given as its third input argument. Complete the routine and apply
                   it to interpolate the four data points {(−1,f(−1)), (−0.2,f(−0.2)),
                                                                         2
                   (0.1,f (0.1)), (0.8,f(0.8))} on the graph of f(x) = 1/(1 + 8x ) for
                   xi = [-100:100]/100 and plot the interpolated curve together with the
                   graph of the true function f(x). Does it work well? How about doing
                   the same job with another routine “rat_interp()” listed in Section 8.3
                   of [F-1]? What are the values of yi([95:97]) obtained from the two
                   routines? If you come across anything odd in the graphic results and/or
                   the output numbers, what is your explanation?
                   (cf) MATLAB expresses the in-determinant 0/0 (zero-divided-by-zero) as NaN
                       (Not-a-Number) and skips the value when plotting it on a graph. It may,
                       therefore, be better off for the plotting purpose if we take no special
                       consideration into the case of in-determinant.
                (b) Apply the Pade approximation routine “padeap()” (with M=2 & N=
                                                                             2
                   2) to generate the rational function approximating f(x) = 1/(1 + 8x )
                   and compare the result with the true function f(x).
                (c) To compare the rational interpolation method with the Pade approx-
                   imation scheme, apply the routines rational_interpolation() and
                   padeap() (with M=3 & N=2) to interpolate the four data points
                   {(−2,f (−2)), (−1,f(−1)), (1,f(1)), (2,f (2))} on the graph of
                   f(x) = sin(x) for xi = [-100:100]*pi/100 and plot the interpolated
                   curve together with the graph of the true function. How do you compare
                   the approximation/interpolation results?
            3.7 Smoothness of a Cubic Spline Function

                We claim that the cubic spline interpolation function s(x) has the smooth-
                ness property of


                                 x k+1            x k+1

                                          2                 2
                                    (s (x)) dx ≤     (f (x)) dx         (P3.7.1)
                                 x k             x k
                for any second-order differentiable function f(x) matching the given grid
                points and having the same first-order derivatives as s(x) at the grid points.
                This implies that the cubic spline functions are not so rugged. Prove it by
                doing the following.
                (a) Check the validity of the equality

                               x k+1              x k+1

                                                           2
                                  f (x)s (x) dx =    (s (x)) dx         (P3.7.2)
                              x k                x k
   168   169   170   171   172   173   174   175   176   177   178