scatteredInterpolant
Interpolate 2-D or 3-D scattered data
Description
Use scatteredInterpolant
to perform interpolation on a 2-D
or 3-D data set of scattered data.
scatteredInterpolant
returns the interpolant
F
for the given data set. You can evaluate F
at a
set of query points, such as (xq,yq)
in 2-D, to produce interpolated
values vq = F(xq,yq)
.
Use griddedInterpolant
to perform interpolation
with gridded data.
Creation
Syntax
Description
creates an
empty scattered data interpolant object.F
= scatteredInterpolant
specifies an interpolation method F
= scatteredInterpolant(___,Method
)'nearest'
,
'linear'
, or 'natural'
as the last
input argument in any of the first three syntaxes.
specifies both the interpolation and extrapolation methods. Pass
F
= scatteredInterpolant(___,Method
,ExtrapolationMethod
)Method
and ExtrapolationMethod
together as the last two input arguments in any of the first three
syntaxes.
Input Arguments
Properties
Usage
Description
Use scatteredInterpolant
to create the interpolant,
F
. Then you can evaluate F
at specific
points using any of the following syntaxes.
Vq = F(Pq)
evaluates F
at the query
points in the matrix Pq
. Each row in Pq
contains the coordinates of a query point.
Vq = F(Xq,Yq)
and Vq = F(Xq,Yq,Zq)
specify query points as two or three arrays of equal size. F
treats the query points as column vectors, for example, Xq(:)
.
If the
Values
property ofF
is a column vector representing one set of values at the sample points, thenVq
is the same size as the query points.If the
Values
property ofF
is a matrix representing multiple sets of values at the sample points, thenVq
is a matrix, and each column represents a different set of values at the query points.
Vq = F({xq,yq})
and
Vq = F({xq,yq,zq})
specify query points as grid vectors. Use
this syntax to conserve memory when you want to query a large grid of
points.
Examples
More About
Tips
It is quicker to evaluate a
scatteredInterpolant
objectF
at many different sets of query points than it is to compute the interpolations separately using the functionsgriddata
orgriddatan
. For example:% Fast to create interpolant F and evaluate multiple times F = scatteredInterpolant(X,Y,V) v1 = F(Xq1,Yq1) v2 = F(Xq2,Yq2) % Slower to compute interpolations separately using griddata v1 = griddata(X,Y,V,Xq1,Yq1) v2 = griddata(X,Y,V,Xq2,Yq2)
To change the interpolation sample values or interpolation method, it is more efficient to update the properties of the interpolant object
F
than it is to create a newscatteredInterpolant
object. When you updateValues
orMethod
, the underlying Delaunay triangulation of the input data does not change, so you can compute new results quickly.Scattered data interpolation with
scatteredInterpolant
uses a Delaunay triangulation of the data, so interpolation can be sensitive to scaling issues in the sample pointsx
,y
,z
, orP
. When scaling issues occur, you can usenormalize
to rescale the data and improve the results. See Normalize Data with Differing Magnitudes for more information.
Algorithms
scatteredInterpolant
uses a Delaunay triangulation of the scattered
sample points to perform interpolation [1].
References
[1] Amidror, Isaac. “Scattered data interpolation methods for electronic imaging systems: a survey.” Journal of Electronic Imaging. Vol. 11, No. 2, April 2002, pp. 157–176.
Extended Capabilities
Version History
Introduced in R2013aSee Also
griddedInterpolant
| griddata
| griddatan
| ndgrid
| meshgrid