MATLAB Recipes for Earth Sciences

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 first, then in the other direction. Intuitively, the bilinear method is one of the simplest interpolation techniques. 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 filled 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 outline 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.
...