griddedInterpolant
Gridded data interpolation
Description
UsegriddedInterpolant
to perform interpolation on a 1-D, 2-D, 3-D, or N-Dgridded dataset.griddedInterpolant
returns theinterpolantF
for the given dataset. You can evaluateF
at a set of query points, such as(xq,yq)
in 2-D, to produce interpolated valuesvq = F(xq,yq)
。
UsescatteredInterpolant
to perform interpolation withscattered data。
Creation
Syntax
F = griddedInterpolant
F = griddedInterpolant(x,v)
F = griddedInterpolant(X1,X2,...,Xn,V)
F = griddedInterpolant(V)
F = griddedInterpolant({xg1,xg2,...,xgn},V)
F = griddedInterpolant(___,Method)
F = griddedInterpolant(___,Method,ExtrapolationMethod)
Description
creates an empty gridded data interpolant object.F
= griddedInterpolant
creates a 2-D, 3-D, or N-D interpolant using afull gridof sample points passed as a set ofF
= griddedInterpolant(X1
,X2
,...,Xn
,V
)n
-dimensional arraysX1,X2,...,Xn
。TheV
array contains the sample values associated with the point locations inX1,X2,...,Xn
。Each of the arraysX1,X2,...,Xn
must be the same size asV
。
用途the default grid to create the interpolant. When you use this syntax,F
= griddedInterpolant(V
)griddedInterpolant
defines the grid as a set of points whose spacing is1
and range is [1
,size(V,i)
] in thei
th dimension. Use this syntax when you want to conserve memory and are not concerned about the absolute distances between points.
specifiesF
= griddedInterpolant({xg1,xg2,...,xgn}
,V
)n
grid vectorsto describe ann
-dimensional grid of sample points. Use this syntax when you want to use a specific grid and also conserve memory.
指定一个替代插值方法:F
= griddedInterpolant(___,Method
)'linear'
,'nearest'
,'next'
,'previous'
,'pchip'
,'cubic'
,'makima'
, or'spline'
。You can specifyMethod
as the last input argument in any of the previous syntaxes.
specifies both the interpolation and extrapolation methods.F
= griddedInterpolant(___,Method
,ExtrapolationMethod
)griddedInterpolant
用途ExtrapolationMethod
to estimate the value when your query points fall outside the domain of your sample points.
Input Arguments
Properties
Usage
UsegriddedInterpolant
to create theinterpolant,F
。Then you can evaluateF
at specific points using any of the following syntaxes:
Vq = F(Xq)
specifies the query points in the matrixXq
。Each row ofXq
contains the coordinates of a query point.Vq = F(xq1,xq2,...,xqn)
specifies the query pointsxq1,xq2,...,xqn
as column vectors of lengthm
representingm
points scattered inn
-dimensional space.Vq = F(Xq1,Xq2,...,Xqn)
specifies the query points using then
-dimensional arraysXq1,Xq2,...,Xqn
, which define afull gridof points.Vq = F({xgq1,xgq2,...,xgqn})
specifies the query points asgrid vectors。当你想要使用这种语法节约内存to query a large grid of points.
Examples
Definitions
Tips
It is quicker to evaluate a
griddedInterpolant
objectF
at many different sets of query points than it is to compute the interpolations separately usinginterp1
,interp2
,interp3
, orinterpn
。For example:% Fast to create interpolant F and evaluate multiple timesF = griddedInterpolant(X1,X2,V) v1 = F(Xq1) v2 = F(Xq2)% Slower to compute interpolations separately using interp2v1 = interp2(X1,X2,V,Xq1) v2 = interp2(X1,X2,V,Xq2)
See Also
fillmissing
|filloutliers
|interp1
|interp2
|interp3
|interpn
|meshgrid
|ndgrid
|scatteredInterpolant