|MATLAB Function Reference|
ZI = griddata(x,y,z,XI,YI)
fits a surface of the form
z = f(x,y) to the data in the (usually) nonuniformly spaced vectors
griddata interpolates this surface at the points specified by
(XI,YI) to produce
ZI. The surface always passes through the data points.
YI usually form a uniform grid (as produced by
XI can be a row vector, in which case it specifies a matrix with constant columns. Similarly,
YI can be a column vector, and it specifies a matrix with constant rows.
[XI,YI,ZI] = griddata(x,y,z,xi,yi)
returns the interpolated matrix
ZI as above, and also returns the matrices
YI formed from row vector
xi and column vector
yi. These latter are the same as the matrices returned by
[...] = griddata(...,method)
uses the specified interpolation method:
||Triangle-based linear interpolation (default)
||Triangle-based cubic interpolation
||Nearest neighbor interpolation
method defines the type of surface fit to the data. The
'v4' methods produce smooth surfaces while
'nearest' have discontinuities in the first and zero'th derivatives, respectively. All the methods except
'v4' are based on a Delaunay triangulation of the data.
YI can be matrices, in which case
griddata returns the values for the corresponding points
(XI(i,j),YI(i,j)). Alternatively, you can pass in the row and column vectors
yi, respectively. In this case,
griddata interprets these vectors as if they were matrices produced by the command
griddata(...,'v4') command uses the method documented in . The other
griddata methods are based on a Delaunay triangulation of the data that uses Qhull . This triangulation uses the Qhull joggle option (
'QJ'). For information about Qhull, see http://www.geom.umn.edu/software/qhull/. For copyright information, see http://www.geom.umn.edu/software/download/COPYING.html.
Sample a function at 100 random points between ±
z are now vectors containing nonuniformly sampled data. Define a regular grid, and grid the data to it:
Plot the gridded data along with the nonuniform data points used to generate it:
 Barber, C. B., D.P. Dobkin, and H.T. Huhdanpaa, "The Quickhull Algorithm for Convex Hulls," ACM Transactions on Mathematical Software, Vol. 22, No. 4, Dec. 1996, p. 469-483. Available in HTML format at http://www.acm.org/pubs/citations/journals/toms/1996-22-4/p469-barber/ and in PostScript format at ftp://geom.umn.edu/pub/software/qhull-96.ps.
 National Science and Technology Research Center for Computation and Visualization of Geometric Structures (The Geometry Center), University of Minnesota. 1993.
 Sandwell, David T., "Biharmonic Spline Interpolation of GEOS-3 and SEASAT Altimeter Data", Geophysical Research Letters, 2, 139-142,1987.
 Watson, David E., Contouring: A Guide to the Analysis and Display of Spatial Data, Tarrytown, NY: Pergamon (Elsevier Science, Inc.): 1992.