Interpolation
NaturalNeighborInterpolation
interpolate 2D scattered data using the natural neighbor interpolation method
Calling Sequence
Parameters
Description
Examples
Compatibility
NaturalNeighborInterpolation(xy,z)
f:=NaturalNeighborInterpolation(xy,z)
f(x,y)
f(M)
xy

listlist, Array, or Matrix of the form $\left[\left[{x}_{1}\,{y}_{1}\right]\,\left[{x}_{2}\,{y}_{2}\right]\,\dots \,\left[{x}_{n}\,{y}_{n}\right]\right]$; the (x,y) coordinates of the sample points
z
list, Array, or Vector of sample values corresponding to the (x,y) points
x,y
evaluate f at (x,y)
M
a k x 2 Matrix of points at which to evaluate f
The NaturalNeighborInterpolation command creates a function $f\left(x\,y\right)=z$ which can then be evaluated at arbitrary points within the convex hull of the sample points.
The natural neighbor triangular interpolant is defined as follows. First, the Voronoi diagram on the given input points xy is determined. Now, to find $f\left(x\,y\right)$, find what would change if the point $x,y$ would be added to the Voronoi diagram: some of the polygons would shrink to make space for a polygon around $x,y$. If the polygon around point ${x}_{i},{y}_{i}$ would shrink by area ${w}_{i}$, then the value of the interpolant $f\left(x\,y\right)$ is defined as the weighted average of the values ${z}_{i}$, weighted by weights ${w}_{i}$.
A natural neighbor interpolant is ${C}^{1}$ continuous except at the sample points.
This interpolation method does not introduce local minima or maxima or infer trends which are not already present in the input data.
Results may be poor when interpolating near the convex hull of the sample points.
Evaluating f at points outside of the convex hull produces $Float\left(\mathrm{undefined}\right)$.
As with all interpolation methods, the interpolant f always passes through all of the sample values.
Input sample points must not contain duplicates. The presence of duplicate points can lead to unexpected results.
In order to evaluate f at k points, you can put each point in a row of a Matrix M and call f(M) to obtain the k values of f in a kelement Vector. This will be most efficient if M's options are such that its datatype is float[8], its order is C_order, and its storage is rectangular.
$\mathrm{XY}\u2254\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{XY}}{\u2254}\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]$
$Z\u2254\left[0\,0\,0\,0\,1\,0\,0\,0\,0\right]$
${Z}{\u2254}\left[{0}{\,}{0}{\,}{0}{\,}{0}{\,}{1}{\,}{0}{\,}{0}{\,}{0}{\,}{0}\right]$
$f\u2254\mathrm{Interpolation}:\mathrm{NaturalNeighborInterpolation}\left(\mathrm{XY}\,Z\right)$
${f}{\u2254}\left({\mathrm{Natural\; Neighbor\; interpolation\; object\; with\; 9\; sample\; points}}\right)$
f can be polled at specific points.
$f\left(0.5\,0.5\right)$
${0.250000000000000}$
$M\u2254\mathrm{Matrix}\left(\left[\left[1.5\,0.3\right]\,\left[0.7\,1.4\right]\,\left[1.2\,1.8\right]\right]\,\mathrm{datatype}=\mathrm{float}\left[8\right]\,\mathrm{order}=\mathrm{C\_order}\right)$
${M}{\u2254}\left[\begin{array}{cc}{1.50000000000000}& {0.300000000000000}\\ {0.700000000000000}& {1.40000000000000}\\ {1.20000000000000}& {1.80000000000000}\end{array}\right]$
$f\left(M\right)$
$\left[\begin{array}{c}{0.150000000000000}\\ {0.420000000000000}\\ {0.160000000000000}\end{array}\right]$
Use plot3d to plot the interpolated surface.
$\mathrm{plot3d}\left(\left(x\,y\right)\mapsto f\left(x\,y\right)\,0..2\,0..2\,\mathrm{labels}=\left[x\,y\,z\right]\right)$
The Interpolation[NaturalNeighborInterpolation] command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
Download Help Document
What kind of issue would you like to report? (Optional)