Interpolate - Maple Help

Interpolation

 Interpolate
 a general-purpose command for interpolation

 Calling Sequence f := Interpolate(points, data) f := Interpolate(points, data, method, methodargs) f(x1, ..., xn) f(pts)

Parameters

 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.

Description

 • 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 any inversedistanceweighted any kriging any naturalneighbor 2 lineartriangular 2 spline 1 nearest 1 lowest 1 highest 1 linear 1 cubic 1

 • 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.

Examples

 > $\mathrm{with}\left(\mathrm{Interpolation}\right):$
 > $\mathrm{points}≔\left[\left[0,0\right],\left[1,0\right],\left[2,0\right],\left[0,1\right],\left[1,1\right],\left[2,1\right],\left[0,2\right],\left[1,2\right],\left[2,2\right]\right]$
 ${\mathrm{points}}{≔}\left[\left[{0}{,}{0}\right]{,}\left[{1}{,}{0}\right]{,}\left[{2}{,}{0}\right]{,}\left[{0}{,}{1}\right]{,}\left[{1}{,}{1}\right]{,}\left[{2}{,}{1}\right]{,}\left[{0}{,}{2}\right]{,}\left[{1}{,}{2}\right]{,}\left[{2}{,}{2}\right]\right]$ (1)
 > $\mathrm{data}≔\left[0,0,0,0,1,0,0,0,0\right]$
 ${\mathrm{data}}{≔}\left[{0}{,}{0}{,}{0}{,}{0}{,}{1}{,}{0}{,}{0}{,}{0}{,}{0}\right]$ (2)
 > $f≔\mathrm{Interpolate}\left(\mathrm{points},\mathrm{data}\right)$
 ${f}{≔}\left({\mathrm{Natural Neighbor interpolation object with 9 sample points}}\right)$ (3)

f can be polled at specific points.

 > $f\left(0.5,0.5\right)$
 ${0.250000000000000}$ (4)

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≔\mathrm{Interpolate}\left(\mathrm{points},\mathrm{data},\mathrm{method}=\mathrm{radialbasisfunction},\mathrm{gaussian},1.5\right)$
 ${g}{≔}\left(\begin{array}{c}{Raⅆial Basis Function intⅇrpolation obȷⅇct with 9 samplⅇ points}\\ {Raⅆial Basis Function: gaussian}\end{array}\right)$ (5)
 > $g\left(0.5,0.5\right)$
 ${0.271060313298269628}$ (6)

Use the plot3d command to plot the interpolated surface.

 > $\mathrm{plot3d}\left(\left[f,g\right],0..2,0..2,\mathrm{transparency}=0.5,\mathrm{color}=\left[\mathrm{red},\mathrm{blue}\right]\right)$

A 1-dimensional example.

 > $\mathrm{points}≔\left[0,1,3,4,6\right]$
 ${\mathrm{points}}{≔}\left[{0}{,}{1}{,}{3}{,}{4}{,}{6}\right]$ (7)
 > $\mathrm{values}≔\left[1,0,4,4,5\right]$
 ${\mathrm{values}}{≔}\left[{1}{,}{0}{,}{4}{,}{4}{,}{5}\right]$ (8)
 > $f≔\mathrm{Interpolate}\left(\mathrm{points},\mathrm{values}\right)$
 ${\mathrm{Interpolation}}{:-}{\mathrm{SplineInterpolation}}{}\left(\left[\left[\begin{array}{c}0.0\\ 1.0\\ 3.0\\ 4.0\\ 6.0\end{array}\right]\right]{,}\left[\begin{array}{ccccc}1.0& 0.0& 4.0& 4.0& 5.0\end{array}\right]{,}{\mathrm{verify}}{=}{\mathrm{false}}\right)$ (9)
 > $f\left(2\right)$
 ${1.84677419354839}$ (10)
 > $\mathrm{plot}\left(f,0..6\right)$
 > 

Compatibility

 • The Interpolation[Interpolate] command was introduced in Maple 2018.