IMSL_SCAT2DINTERP

Syntax | Return Value | Arguments | Keywords | Discussion | Example | Errors | Version History

The IMSL_SCAT2DINTERP function computes a smooth bivariate interpolant to scattered data that is locally a quintic polynomial in two variables.

Note
This routine requires an IDL Advanced Math and Stats license. For more information, contact your ITT Visual Information Solutions sales or technical support representative.

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

DOUBLE

If present and nonzero, double precision is used.

Discussion

The IMSL_SCAT2DINTERP function computes a C1 interpolant to scattered data in the plane. Given the data points (in R3):

IMSL_SCAT2DINTERP-85.jpg

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:

IMSL_SCAT2DINTERP-86.jpg

is computed. On each triangle T in this triangulation, s has the following form:

IMSL_SCAT2DINTERP-87.jpg

Thus, s is a bivariate quintic polynomial on each triangle of the triangulation. In addition:

IMSL_SCAT2DINTERP-88.jpg

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 Figure 6-15.

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) 
; Define the grid used to evaluate the computed surface. 
surf = IMSL_SCAT2DINTERP(xydata, fdata, xout, yout) 
; Call IMSL_SCAT2DINTERP. 
SURFACE, surf, xout, yout, /Save, Ax = 45, Charsize = 1.5 
; Plot the computed surface. 
PLOTS,  x, y, fdata, /T3d, Symsize = 2, Psym = 2 
; Plot the original data points. 

Figure 6-15: Fit to Scattered Data

interp16.gif

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.

Version History

6.4

Introduced