InverseDistanceWeightedInterpolation - Maple Help

Interpolation

 InverseDistanceWeightedInterpolation
 interpolate N-D scattered data using the inverse distance weighted interpolation method

 Calling Sequence InverseDistanceWeightedInterpolation(points,values) InverseDistanceWeightedInterpolation(points,values,r) f:=InverseDistanceWeightedInterpolation(...) f(x1,...,xn) f(M)

Parameters

 points - listlist, Array, Matrix, Vector, or list of m n-dimensional sample points where each inner list or row represents one point. For a Vector or plain list, n is 1. values - list, Array, or Vector of sample values r - (optional) the radius parameter; the default is infinity x1,...,xn - evaluate f at (x1,...,xn) M - a k x n Matrix of points at which to evaluate f

Description

 • The InverseDistaneWeightedInterpolation command creates a function $f\left(\mathrm{x1},\mathrm{...},\mathrm{xn}\right)=\mathrm{value}$ which can then be evaluated at arbitrary points in ${R}^{n}$.
 • This interpolant is defined at the point $x$ as the weighted average of the values ${\mathrm{values}}_{i}$, where each value is weighted by the inverse of the distance between ${\mathrm{points}}_{i}$ and $x$, and only points at distance at most r of $x$ are used.
 • By default, r is infinity, so all sample points will be used to interpolate a query point.
 • If no points lie within distance r, the interpolated value will be $Float\left(\mathrm{undefined}\right)$.
 • For sufficiently large r, this interpolation method produces a ${C}^{1}$ continuous interpolant.
 • This interpolation method does not introduce local minima or maxima which are not already present in the input data.
 • f can be evaluated at every point in ${R}^{n}$, but results for points far away from the sample points may not be meaningful.
 • 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 k-element 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.

Examples

 > $\mathrm{XY}≔\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}}{≔}\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)
 > $Z≔\left[0,0,0,0,1,0,0,0,0\right]$
 ${Z}{≔}\left[{0}{,}{0}{,}{0}{,}{0}{,}{1}{,}{0}{,}{0}{,}{0}{,}{0}\right]$ (2)
 > $f≔\mathrm{Interpolation}:-\mathrm{InverseDistanceWeightedInterpolation}\left(\mathrm{XY},Z,1.5\right)$
 ${f}{≔}\left(\begin{array}{c}{Invⅇrsⅇ Distancⅇ Wⅇightⅇⅆ intⅇrpolation obȷⅇct with 9 samplⅇ points}\\ {Raⅆius of influⅇncⅇ: 1.5}\end{array}\right)$ (3)

f can be polled at specific points.

 > $f\left(0.5,0.5\right)$
 ${0.250000000000000000}$ (4)
 > $M≔\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}{≔}\left[\begin{array}{cc}{1.50000000000000}& {0.300000000000000}\\ {0.700000000000000}& {1.40000000000000}\\ {1.20000000000000}& {1.80000000000000}\end{array}\right]$ (5)
 > $f\left(M\right)$
 $\left[\begin{array}{c}{0.0913991699478318}\\ {0.599109577735220}\\ {0.0335025560440729}\end{array}\right]$ (6)

Use plot3d to plot the interpolated surface.

 > $\mathrm{plot3d}\left(\left(x,y\right)↦f\left(x,y\right),0..2,0..2,\mathrm{labels}=\left[x,y,z\right]\right)$

Compatibility

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