Page 174 - MATLAB Recipes for Earth Sciences
P. 174

7.8 Comparison of Methods and Potential Artifacts               169

           The biharmonic spline interpolation described in this chapter provides a so-
           lution to most gridding problems. It therefore was the only gridding method
           that came with MATLAB for quite a long time. However, different applica-
           tions in earth sciences require different methods for interpolation.  However,
           there is no method without problems. The next chapter compares biharmon-
           ic splines with other gridding methods and summarizes their strengths and
           weaknesses.




           7.8 Comparison of Methods and Potential  Artifacts

           The first example illustrates the use of the  bilinear interpolation technique
           for gridding irregular-spaced data. Bilinear interpolation is an extension of
           the one-dimensional linear interpolation. In the two-dimensional case, linear
           interpolation is performed in one direction fi rst, then in the other direction.
           Intuitively, the bilinear method is one of the simplest interpolation tech-
           niques. One would not expect serious artifacts and distortions of the data.
           On the contrary, this method has a number of disadvantages and therefore
           other methods are used in many applications.
             The sample data used in the previous chapter can be loaded to study the
           performance of a bilinear interpolation.

             data = load('normalfault.txt');
             labels = num2str(data(:,3),2);

           We now choose the option linear while using the function griddata to
           interpolate the data.
             [XI,YI] = meshgrid(420:0.25:470,70:0.25:120);
             ZI = griddata(data(:,1),data(:,2),data(:,3),XI,YI,'linear');

           The result are plotted as fi lled contours. The plot also includes the location
           of the control points.

             contourf(XI,YI,ZI), colorbar, hold on
             plot(data(:,1),data(:,2),'ko')
           The new surface is restricted to the area that contains control points. By
           default, bilinear interpolation does not extrapolate beyond this region.
           Furthermore, the contours are rather angular compared to the smooth out-
           line of the biharmonic spline interpolation. The most important character of
           the bilinear gridding technique, however, is illustrated by a projection of the
           data in a vertical plane.
   169   170   171   172   173   174   175   176   177   178   179