FUNCTION REFERENCE
griddata
Interpolate scattered two-dimensional data.
Interpolate scattered two-dimensional data.
Syntax
vq = griddata(x, y, v, xq, yq)Syntax
vq = griddata(x, y, v, xq, yq, method)Syntax
[xq, yq, vq] = griddata(...)method is 'linear' (default), 'nearest', 'natural', 'cubic' or 'v4'. A row xq with a column yq is expanded to a grid. Duplicate points are merged and their values averaged, with a warning. Query points outside the convex hull give NaN, except with 'v4'. 'cubic' is C1 (smooth across triangle edges) and reproduces linear data exactly.
Example
griddata([0 1 1 0 0.5], [0 0 1 1 0.5], [0 1 2 1 0.75], 0.25, 0.75) % 0.8750Example
griddata([0 1 1 0 0.5], [0 0 1 1 0.5], [1 3 6 4 3.5], 0.25, 0.75, 'cubic') % 3.7500Differences from MATLAB: 'cubic' is a Clough-Tocher interpolant with minimum norm network gradient estimates (Nielson, Renka and Cline). MATLAB's own gradient estimate is not identified, so results can differ from MATLAB's in the third decimal place. The three-dimensional form griddata(x, y, z, v, xq, yq, zq) is not supported.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.