Gridded data interpolation
Note:
The behavior of 
Use griddedInterpolant
to
perform interpolation on a 1D, 2D, 3D, or ND Gridded Data set. For example, you can
pass a set of (x,y)
points and values, v
,
to griddedInterpolant
, and it returns a surface of
the form v = F(x, y).
This surface always passes through the sample values at the point
locations. You can evaluate this surface at any query point, (xq,yq)
,
to produce an interpolated value, vq
.
Use griddedInterpolant
to create the Interpolant, F
. Then
you can evaluate F
at specific points using any
of the following syntaxes:
Vq = F(Xq)
evaluates F
at
a set of query points in matrix Xq
. The points
in Xq
are scattered, and each row of Xq
contains
the coordinates of a query point.
Vq = F(xq1,xq2,...,xqn)
specifies
the query locations, xq1,xq2,...,xqn
, as column
vectors of length m
representing m
points
scattered in n
dimensional space.
Vq = F(Xq1,Xq2,...,Xqn)
specifies
the query locations as n
n
dimensional
arrays, Xq1,Xq2,...,Xqn
, of equal size which define
a Full Grid of points.
Vq = F({xgq1,xgq2,...,xgqn})
specifies
the query locations as Grid Vectors .
Use this syntax to conserve memory when you want to query a large
grid of points.
creates
a 1D interpolant from a vector of sample points, F
= griddedInterpolant(x
,v
)x
,
and corresponding values, v
.
creates
a 2D, 3D, or ND interpolant using a Full Grid of sample points passed as a set of F
= griddedInterpolant(X1,X2,...,Xn
,V
)n
dimensional
arrays, X1,X2,...,Xn
. The V array contains the
sample values associated with the point locations in X1,X2,...,Xn
.
Each of the arrays, X1,X2,...,Xn
must be the same
size as V
.
uses
the default grid to create the interpolant. When you use this syntax, F
= griddedInterpolant(V
)griddedInterpolant
defines
the grid as set of points whose spacing is 1
and
range is [1
, size(V,i)
] in the i
th
dimension. Use this syntax when you want to conserve memory and are
not concerned about the absolute distances between points.
specifies F
= griddedInterpolant({xg1,xg2,...,xgn}
,V
)n
Grid Vectors to describe an n
dimensional
grid of sample points. Use this syntax when you want to use a specific
grid and also conserve memory.
specifies
an interpolation method: F
= griddedInterpolant(___,Method
)'linear'
, 'nearest'
, 'next'
, 'previous'
, 'pchip'
, 'cubic'
,
or 'spline'
. You can specify Method
as
the last input argument in any of the first four syntaxes.
specifies
both the interpolation and extrapolation methods. F
= griddedInterpolant(___,Method
,ExtrapolationMethod
)griddedInterpolant
uses ExtrapolationMethod
to
estimate the value when your query points fall outside the domain
of your sample points. Specify Method
and ExtrapolationMethod
together
as the last two input arguments in any of the first four syntaxes.

Sample points vector, specified as a vector of input coordinates
the same size as  

Sample values vector, specified as a vector of input values
the same size as  

Sample points in Full Grid form,
specified as a set of  

Sample points in grid
vector form, specified as a cell array of grid vectors. These
vectors must specify a grid that is the same size as  

Sample values, specified as an array. The elements of
 

Interpolation method, specified as one of these options.
 

Extrapolation method, specified as any of the If you omit 

Cell array containing grid vectors, 

Array of values associated with the grid points in 

A character vector specifying the name of a method used to interpolate
the data. 

A character vector specifying the name of a method used to extrapolate
the data. 
Interpolating function that you can evaluate at query locations.
A set of points that are axisaligned and ordered.
A set of points that have no structure among their relative locations.
A grid represented as a set of arrays. For example, you can
create a full grid using ndgrid
.
A set of vectors that serve as a compact representation of a
grid in ndgrid
format. For example, [X,Y]
= ndgrid(xg,yg)
returns a full grid
in the matrices X
and Y
. You
can represent the same grid using the grid vectors, xg
and yg
.
Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB^{®} documentation.
Indexbased editing of the properties of F
are
not supported. Instead, wholly replace the GridVectors
or Values
arrays
as necessary. See Interpolation with the griddedInterpolant Class in
the MATLAB Mathematics documentation for more information.