The IMSL_SCAT2DINTERP function computes a smooth bivariate interpolant to scattered data that is locally a quintic polynomial in two variables.
This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.
The IMSL_SCAT2DINTERP function computes a C1 interpolant to scattered data in the plane. Given the data points (in R3):
where n = N_ELEMENTS(Xydata) / 2, IMSL_SCAT2DINTERP returns the values of the interpolant s on the user-specified grid. The computation of s is as follows.
First, the Delaunay triangulation of the points:
is computed. On each triangle T in this triangulation, s has the following form:
Thus, s is a bivariate quintic polynomial on each triangle of the triangulation. In addition:
and s is continuously differentiable across the boundaries of neighboring triangles. These conditions do not exhaust the freedom implied by the above representation. This additional freedom is exploited in an attempt to produce an interpolant that is faithful to the global shape properties implied by the data. For more information on this procedure, refer to the article by Akima (1978). The output grid is specified by the two real vectors, xout and yout, that represent the first (second) coordinates of the grid.
Example
In this example, IMSL_SCAT2DINTERP is used to fit a surface to randomly scattered data. The resulting surface and the original data points are then plotted as shown in the figure that follows:
IMSL_RANDOMOPT, Set = 12345 ndata = 15
xydata = FLTARR(2, ndata)
xydata(*) = IMSL_RANDOM(2 * ndata)
fdata = IMSL_RANDOM(ndata)
x = xydata(0, *) y = xydata(1, *) ngrid = 20
xout = FINDGEN(ngrid)/(ngrid - 1)
yout = FINDGEN(ngrid)/(ngrid - 1)
surf = IMSL_SCAT2DINTERP(xydata, fdata, xout, yout)
SURFACE, surf, xout, yout, /Save, Ax = 45, Charsize = 1.5
PLOTS, x, y, fdata, /T3d, Symsize = 2, Psym = 2
Errors
Fatal Errors
MATH_DUPLICATE_XYDATA_VALUES: Two-dimensional data values must be distinct.
MATH_XOUT_NOT_STRICTLY_INCRSING: Vector xout must be strictly increasing.
MATH_YOUT_NOT_STRICTLY_INCRSING: Vector yout must be strictly increasing.
Syntax
Result = IMSL_SCAT2DINTERP(Xydata, Fdata, Xout, Yout [, /DOUBLE])
Return Value
A two-dimensional array containing the grid of values of the interpolant.
Arguments
Xydata
Two-dimensional array containing the data points for the interpolation problem. Argument Xydata is dimensioned (2, N_ELEMENTS (Fdata)). The i-th data point (xi, yi) is stored in Xydata (0, i) = xi and Xydata (1, i) = yi.
Fdata
One-dimensional array containing the values to be interpolated.
Xout
One-dimensional array specifying the x values for the output grid. It must be strictly increasing.
Yout
One-dimensional array specifying the y values for the output grid. It must be strictly increasing.
Keywords
DISTANCE (optional)
Proportion of the distance the ordinate in error is moved to its interpolating curve. It must be in the range 0.0 to 1.0. Default: 1.0
DOUBLE (optional)
If present and nonzero, double precision is used.
Version History