Interpolation
Interpolate
a general-purpose command for interpolation
Calling Sequence
Parameters
Description
Examples
Compatibility
f := Interpolate(points, data)
f := Interpolate(points, data, method, methodargs)
f(x1, ..., xn)
f(pts)
points
-
a list, listlist, Array, Vector, or Matrix containing the numeric coordinates of the independent points corresponding to data values. If points is a listlist, each inner list must contain n entries, where n is the dimension of the data. If points is an Array or Matrix, then there must be n columns, with each row corresponding to one point. If points is a list or Vector of numeric values, then n is 1 and each value is a separate point.
data
a list, Array, or Vector containing the data, which must be arranged in the same order as the corresponding coordinates appear in points.
method
an optional keyword option of the form method=m, where m is one of inversedistanceweighted, lineartriangular, radialbasisfunction, kriging, naturalneighbor, nearest, lowest, highest, linear, cubic, or spline.
methodargs
(optional) the same optional arguments available when calling a specific interpolation method are available through this Interpolate command. For details, see the help page for the specific method being used.
The Interpolate command is a general-purpose command used for interpolation. To perform the interpolation, a variety of different methods can be used as specified by the method option. This command will return an interpolation object which can then be used as a procedure, taking the coordinates of a point as parameters and giving the interpolated result as the return value.
The values for the method option correspond to the following interpolation methods, and the supported dimensions for the independent points in points:
Value for 'method'
Interpolation Method
Dimension
radialbasisfunction
Radial Basis Function Interpolation
any
inversedistanceweighted
Inverse Distance Weighted Interpolation
kriging
Kriging Interpolation
naturalneighbor
Natural Neighbor Interpolation
2
lineartriangular
Linear Triangular Interpolation
spline
Spline Interpolation
1
nearest
Nearest Neighbor Interpolation
lowest
Lowest Neighbor Interpolation
highest
Highest Neighbor Interpolation
linear
Linear Interpolation
cubic
Cubic Interpolation
The default method is spline if the input points are one-dimensional, naturalneighbor if the input points are two-dimensional, and radialbasisfunction otherwise.
The methods that are listed as supporting only dimension 1, above, do support higher dimensions, but only for independent points that are arranged in a grid. The way such points are then specified is not compatible with the way points are specified for the other commands, so the Interpolate command doesn't support this. However, you can make use of this functionality by calling the corresponding commands (linked in the table above) directly.
with⁡Interpolation:
points≔0,0,1,0,2,0,0,1,1,1,2,1,0,2,1,2,2,2
data≔0,0,0,0,1,0,0,0,0
f≔Interpolate⁡points,data
f≔Natural Neighbor interpolation object with 9 sample points
f can be polled at specific points.
f⁡0.5,0.5
0.250000000000000
We do the same with a different method. We supply two parameters to this method (explained on the Radial Basis Function Interpolation help page).
g≔Interpolate⁡points,data,method=radialbasisfunction,gaussian,1.5
g≔Raⅆⅈal Basⅈs Functⅈon ⅈntⅇrpolatⅈon obȷⅇct wⅈth 9 samplⅇ poⅈntsRaⅆⅈal Basⅈs Functⅈon: gaussⅈan
g⁡0.5,0.5
0.271060313298269628
Use the plot3d command to plot the interpolated surface.
plot3d⁡f,g,0..2,0..2,transparency=0.5,color=red,blue
A 1-dimensional example.
points≔0,1,3,4,6
values≔1,0,4,4,5
f≔Interpolate⁡points,values
f≔a spline interpolation objectwith 5 points in 1-D
f⁡2
1.84677419354839
plot⁡f,0..6
The Interpolation[Interpolate] command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
Download Help Document