Scattered data interpolation
Use scatteredInterpolant
to perform interpolation
on a 2D or 3D Scattered Data set.
For example, you can pass a set of (x,y)
points
and values, v
, to scatteredInterpolant
,
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 scatteredInterpolant
to create the Interpolant, F
. Then,
you can evaluate F
at specific points using any
of the following syntaxes:
Vq = F(Pq)
specifies
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 the query
points as two or three matrices of equal size.
Vq = F({xq,yq})
and Vq = F({xq,yq,zq})
specify the
query points as Grid Vectors.
The interpolated values are returned in Vq
. Use
this syntax to conserve memory when you want to query a large grid
of points.
creates
an interpolant that fits a surface of the form v = F(x,y).
Vectors F
= scatteredInterpolant(x
,y
,v
)x
and y
specify the (x,y)
coordinates
of the sample points. v
is a vector that contains
the sample values associated with the points, (x,y)
.
creates
a 3D interpolant of the form v = F(x,y,z).F
= scatteredInterpolant(x
,y
,z
,v
)
specifies the coordinates of the sample points as an array. The rows
of F
= scatteredInterpolant(P
,v
)P
contain the (x, y)
or (x, y, z)
coordinates for the values in v
.
specifies
a string that describes an interpolation method: F
= scatteredInterpolant(___,Method
)'nearest'
, 'linear'
,
or 'natural'
. Specify Method
as
the last input argument in any of the first three syntaxes.
specifies
both the interpolation and extrapolation methods as strings. F
= scatteredInterpolant(___,Method
,ExtrapolationMethod
)Method
can
be one of three strings: 'nearest'
, 'linear'
,
or 'natural'
. Specify ExtrapolationMethod
as
one of the following strings: 'nearest'
, 'linear'
,
or 'none'
. Pass Method
and ExtrapolationMethod
together
as the last two input arguments in any of the first three syntaxes.
creates
an empty scattered data interpolant. Use F
= scatteredInterpolant()F.Points = P
to
initialize F
with the points in matrix P
.
Use F.Values = v
to initialize F
with
the values in v
.

Sample points xcoordinates, specified as
a vector of the same size as  

Sample points ycoordinates, specified as
a vector of the same size as  

Sample points zcoordinates, specified as
a vector of the same size as  

Sample points array, specified as an  

Sample values, specified as a vector that defines the function values, v = F(x,y), at the sample points.  

Interpolation method, specified as one of the following options.
 

Extrapolation method, specified as one of these strings.


Array of sample points (locations) for the values in 

Vector of values associated with each point in 

A string specifying the method used to interpolate the data: 

A string specifying the method used to extrapolate the data: 
Interpolating function that you can evaluate at query locations.
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.
scatteredInterpolant
supports indexbased editing
of the properties of F
. You can add or remove
points in F.Points
and update the corresponding
values in F.Values
. For example, F.Points(5,:)
= []
removes the fifth point, and F.Values(5) =
[]
removes the corresponding value.