Mathematics Previous page   Next Page

Comparing Interpolation Methods

This example compares two-dimensional interpolation methods on a 7-by-7 matrix of data.

  1. Generate the peaks function at low resolution.
  2. Generate a finer mesh for interpolation.
  3. Interpolate using nearest neighbor interpolation.
  4. Interpolate using bilinear interpolation:
  5. Interpolate using bicubic interpolation.
  6. Compare the surface plots for the different interpolation methods.

    nearest, bilinear, and bicubic surface plots

  7. Compare the contour plots for the different interpolation methods.

    nearest, bilinear, and bicubic contour plots

Notice that the bicubic method, in particular, produces smoother contours. This is not always the primary concern, however. For some applications, such as medical image processing, a method like nearest neighbor may be preferred because it doesn't generate any "new" data values.


Previous page  Two-Dimensional Interpolation Interpolation and Multidimensional Arrays Next page

© 1994-2005 The MathWorks, Inc.