The USTCHEX interpolation routines provide multiple approaches for estimating values from scattered or tabulated data. Selection should be guided by data dimensionality, smoothness requirements, locality versus global consistency, and whether derivative or statistical structure is important.
IDW (Modified Shepard): Recommended for fast, local interpolation of scattered two-dimensional data when simplicity and locality are desired. The modified Shepard formulation with adaptive neighborhood radius provides improved stability compared to classical global IDW. Suitable for exploratory analysis and moderately smooth fields.
Barnes Objective Analysis: Recommended when a smooth, globally consistent field is preferred, particularly for noisy or irregularly distributed data. Iterative residual correction allows recovery of structure while maintaining overall smoothness. Best suited for surface generation and contouring where visual coherence is important.
Lagrange (Local Polynomial): Recommended for one-dimensional tabulated data when local polynomial smoothness and derivative evaluation are required. The localized stencil avoids the instability of global polynomial interpolation and supports first- through higher-order derivatives.
Kriging (Ordinary Kriging): Recommended when spatial correlation structure is meaningful and sufficient data are available to justify variogram modeling. Provides statistically grounded interpolation with unbiasedness constraints, at the cost of higher computational expense.
Franke–Nielsen Quadratic Modified Shepard: Recommended when higher smoothness and local curvature accuracy are required from scattered two-dimensional data. The Franke–Nielsen formulation combines local quadratic fitting with modified Shepard blending, producing smoother and more accurate surfaces than standard IDW or Barnes methods for well-distributed datasets.
USTCHEX_IDW: Modified Shepard inverse-distance weighting (IDW) single-point interpolation
Description:
Estimates a scalar value z(Xq,Yq) from scattered 2D data (xi,yi,zi) using a Modified Shepard inverse-distance weighting scheme with an adaptively selected finite neighborhood radius. Only data points within the effective radius contribute to the interpolated value, and weights are normalized to sum to unity. If the query point coincides with a data point, the corresponding ziz_izi value is returned exactly. A nearest-neighbor fallback is applied if no points fall within the effective neighborhood. A small smoothing term sig is included in the distance calculation to regularize near-coincident points and improve numerical stability.
Syntax:
=USTCHEX_IDW(xi, yi, zi, Xq, Yq, [nw], [sig])
xi:
Range of x-coordinates of the data points (single column).
yi:
Range of y-coordinates of the data points (single column).
zi:
Range of z-values at the data points (single column).
Xq:
Query x-coordinate.
Yq:
Query y-coordinate.
nw (Optional):
Neighborhood size parameter used internally to determine the effective radius of influence. Larger values generally include more contributing points.
Default: 18
sig (Optional):
Distance smoothing term added inside the distance calculation. Use a small positive value to reduce sensitivity near coincident or clustered points.
Default: 0
Returns:
A single interpolated scalar value.
Notes:
• Implements a Modified Shepard formulation with finite support radius.
• Automatically adapts the neighborhood size based on data spread and nw.
• Returns exact data values for coincident query points.
• Falls back to nearest-neighbor interpolation if the effective neighborhood is empty.
• Best suited for scattered data requiring smooth local interpolation without global influence.
Example:
=USTCHEX_IDW(A2:A101, B2:B101, C2:C101, 12.5, 7.2)
USTCHEX_IDWGRID: Modified Shepard inverse-distance weighting (IDW) grid interpolation
Description:
Applies the same Modified Shepard inverse-distance weighting scheme used by USTCHEX_IDW to evaluate interpolated values over a two-dimensional grid. Grid points are defined by horizontal xp and vertical yp coordinate arrays, and each grid location is evaluated independently using the same adaptive neighborhood radius, smoothing, and fallback behavior as the single-point formulation.
Syntax:
=USTCHEX_IDWGRID(xi, yi, zi, xp, yp, [nw], [sig])
xi:
Range of x-coordinates of the data points (single column).
yi:
Range of y-coordinates of the data points (single column).
zi:
Range of z-values at the data points (single column).
xp:
Range containing x-grid coordinates laid out horizontally.
yp:
Range containing y-grid coordinates laid out vertically.
nw (Optional):
Neighborhood size parameter used internally to determine the effective radius of influence.
Default: 18
sig (Optional):
Distance smoothing term added inside the distance calculation.
Default: 0
Returns:
A 2-D spill array of interpolated values, where rows correspond to yp and columns correspond to xp.
Notes:
• Uses the same Modified Shepard kernel as USTCHEX_IDW.
• Each grid point is evaluated independently with adaptive neighborhood selection.
• Exact data values are preserved at coincident grid locations.
• Nearest-neighbor fallback is applied if no points fall within the effective radius.
Example:
=USTCHEX_IDWGRID(A2:A101, B2:B101, C2:C101, E1:N1, D2:D21)
USTCHEX_BARNES: Iterative Barnes objective analysis (single-point interpolation)
Description:
Estimates a scalar value z(Xq,Yq) from scattered 2D data (xi,yi,zi) using the Barnes objective analysis method with iterative residual correction. The algorithm begins with a first-pass Gaussian-weighted analysis and subsequently refines the estimate through repeated correction passes based on residuals between observed and analyzed values. Iteration continues until a user-defined convergence tolerance is satisfied or a maximum iteration count is reached. This approach produces smooth fields while progressively restoring small-scale structure.
Syntax:
=USTCHEX_BARNES(xi, yi, zi, Xq, Yq, [iter_limit], [tol])
xi:
Range of x-coordinates of the data points (single column).
yi:
Range of y-coordinates of the data points (single column).
zi:
Range of z-values at the data points (single column).
Xq:
Query x-coordinate.
Yq:
Query y-coordinate.
iter_limit (Optional):
Maximum number of Barnes correction iterations.
Default: 100
tol (Optional):
Convergence tolerance based on the norm of successive analysis updates.
Default: 1×10⁻⁴
Returns:
A single interpolated scalar value at (Xq,Yq)(X_q,Y_q)(Xq,Yq).
Notes:
• Implements classical Barnes objective analysis with Gaussian weighting.
• Uses iterative residual correction to recover structure lost in the first pass.
• Produces smoother results than IDW-type methods, especially for noisy data.
• Convergence is controlled by tol and iter_limit.
• Best suited for smoothly varying fields where global consistency is desired.
Example:
=USTCHEX_BARNES(A2:A101, B2:B101, C2:C101, 12.5, 7.2)
USTCHEX_BARNESGRID: Iterative Barnes objective analysis over a 2D grid
Description:
Applies the same iterative Barnes objective analysis used by USTCHEX_BARNES to compute a full two-dimensional interpolated field over a specified grid. Grid points are defined by horizontal xp and vertical yp coordinate arrays. The field is initialized using a first-pass Barnes analysis and is subsequently refined through iterative residual correction at all grid points until convergence criteria are met.
Syntax:
=USTCHEX_BARNESGRID(xi, yi, zi, xp, yp, [iter_limit], [tol])
xi:
Range of x-coordinates of the data points (single column).
yi:
Range of y-coordinates of the data points (single column).
zi:
Range of z-values at the data points (single column).
xp:
Range containing x-grid coordinates laid out horizontally.
yp:
Range containing y-grid coordinates laid out vertically.
iter_limit (Optional):
Maximum number of Barnes correction iterations.
Default: 100
tol (Optional):
Convergence tolerance based on the global update norm between iterations.
Default: 1×10⁻⁴
Returns:
A 2-D spill array of interpolated values, where rows correspond to yp and columns correspond to xp.
Notes:
• Uses the same Barnes kernel and iterative residual correction as USTCHEX_BARNES.
• Produces smooth, spatially coherent fields suitable for contouring and surface visualization.
• More computationally intensive than IDW-based methods due to iterative refinement.
• Convergence behavior depends on data density, spatial distribution, and tolerance settings.
Example:
=USTCHEX_BARNESGRID(A2:A101, B2:B101, C2:C101, E1:N1, D2:D21)
USTCHEX_LAGRANGE: Localized Lagrange polynomial interpolation with derivative evaluation (up to 3rd order)
Description:
Evaluates a localized Lagrange interpolating polynomial at a specified query point using the nearest data points to the query location. The function automatically selects (order+1)(\text{order}+1)(order+1) nearest unique data points and constructs the corresponding Lagrange polynomial locally, improving numerical stability compared to global polynomial interpolation. In addition to the interpolated value, the function can return the first, second, or third derivative of the interpolating polynomial evaluated at the query point. Exact data values are returned for coincident query points.
Syntax:
=USTCHEX_LAGRANGE(xdata, ydata, xquery, [order], [derivative])
xdata:
Range or vector of x-values corresponding to the independent variable. Data need not be uniformly spaced; ascending order is recommended but not required.
ydata:
Range or vector of y-values corresponding to xdata. Must be the same length as xdata.
xquery:
Query x-value at which the interpolation or derivative is evaluated.
order (Optional):
Polynomial order of the local interpolant.
• 1 → linear
• 2 → quadratic
• 3 → cubic
• higher values allowed subject to available data
Default: 1
derivative (Optional):
Order of the derivative to return.
• 0 → interpolated value yyy
• 1 → first derivative dy/dxdy/dxdy/dx
• 2 → second derivative d2y/dx2d^2y/dx^2d2y/dx2
• 3 → third derivative d3y/dx3d^3y/dx^3d3y/dx3
Default: 0
Returns:
A single scalar value corresponding to the interpolated function value or the requested derivative at xquery.
Notes:
• Uses a local stencil of nearest points rather than a global polynomial fit.
• Automatically avoids duplicate x-values within numerical tolerance.
• Returns the exact data value if xquery coincides with a data point.
• Higher polynomial orders increase sensitivity to noise and should be used with care.
• Suitable for smooth data where local derivative estimates are required.
Example:
=USTCHEX_LAGRANGE(A2:A10, B2:B10, 2.5, 3, 2)
(Second derivative of a locally fitted cubic polynomial at x = 2.5)
USTCHEX_KRIGING: Ordinary kriging interpolation with parametric variogram models (single-point)
Description:
Estimates a scalar value f(Xq,Yq)f(X_q,Y_q)f(Xq,Yq) from scattered 2D data (xi,yi,fi)(x_i,y_i,f_i)(xi,yi,fi) using ordinary kriging with a parametric variogram model. The method constructs and solves the kriging system augmented with a Lagrange multiplier to enforce unbiasedness (weights summing to unity). Several common variogram models are supported, and key variogram parameters may be specified explicitly or estimated automatically from the data. If only a single data point is provided, its value is returned directly.
Syntax:
=USTCHEX_KRIGING(xdat, ydat, fdat, Xq, Yq, [VarType], [Nugget], [Sill], [RangeParam])
xdat:
Range of x-coordinates of the data points (single column).
ydat:
Range of y-coordinates of the data points (single column).
fdat:
Range of observed values at the data points (single column).
Xq:
Query x-coordinate.
Yq:
Query y-coordinate.
VarType (Optional):
Variogram model selector.
• 1 → Linear
• 2 → Spherical
• 3 → Exponential
Default: 1
Nugget (Optional):
Nugget effect of the variogram. Represents microscale variation or measurement noise.
Default: 0
Sill (Optional):
Variogram sill. If not provided or non-positive, the sill is estimated automatically from the sample variance of fdat.
RangeParam (Optional):
Effective variogram range. If not provided or non-positive, the range is estimated automatically as the maximum pairwise data-point separation.
Returns:
A single kriging-interpolated scalar value at (Xq,Yq)(X_q,Y_q)(Xq,Yq).
Notes:
• Implements ordinary kriging with an explicit unbiasedness constraint.
• Supports linear, spherical, and exponential variogram models.
• Automatically estimates sill and/or range when not supplied.
• Requires inversion of an (n+1)×(n+1)(n+1)\times(n+1)(n+1)×(n+1) dense matrix; computational cost grows rapidly with data size.
• Best suited for small to moderate datasets where spatial correlation structure is important.
Example:
=USTCHEX_KRIGING(A2:A50, B2:B50, C2:C50, 12.5, 7.2, 2)
USTCHEX_KRIGINGGRID: Ordinary kriging interpolation over a 2D grid
Description:
Applies the same ordinary kriging formulation used by USTCHEX_KRIGING to compute an interpolated field over a two-dimensional grid. Grid locations are defined by horizontal xr and vertical yr coordinate vectors. The kriging system matrix is constructed and inverted once, after which kriging weights are evaluated for each grid point using the selected variogram model. This approach produces a spatially consistent interpolated surface suitable for contouring and surface visualization.
Syntax:
=USTCHEX_KRIGINGGRID(xdat, ydat, fdat, xr, yr, [VarType], [Nugget], [Sill], [RangeParam])\
xdat:
Range of x-coordinates of the data points (single column).
ydat:
Range of y-coordinates of the data points (single column).
fdat:
Range of observed values at the data points (single column).
xr:
Range containing x-grid coordinates (typically a single column or row).
yr:
Range containing y-grid coordinates (typically a single column).
VarType (Optional):
Variogram model selector (1 = Linear, 2 = Spherical, 3 = Exponential).
Nugget (Optional):
Nugget effect of the variogram.
Default: 0
Sill (Optional):
Variogram sill. Automatically estimated if not provided.
RangeParam (Optional):
Effective variogram range. Automatically estimated if not provided.
Returns:
A 2-D spill array of kriging-interpolated values, where rows correspond to yr and columns correspond to xr.
Notes:
• Uses the same variogram models and parameter handling as USTCHEX_KRIGING.
• Inverts the kriging matrix once for efficiency, then reuses it for all grid points.
• Computational cost scales poorly with the number of data points due to dense matrix operations.
• Produces smoother and more statistically grounded surfaces than IDW-type methods when spatial correlation is meaningful.
Example:
=USTCHEX_KRIGINGGRID(A2:A50, B2:B50, C2:C50, E1:N1, D2:D21)
USTCHEX_QIDW: Franke–Nielsen quadratic modified Shepard interpolation (single-point)
Description:
Estimates a scalar value f(Xq,Yq)f(X_q,Y_q)f(Xq,Yq) from scattered two-dimensional data (xi,yi,fi)(x_i,y_i,f_i)(xi,yi,fi) using the Franke–Nielsen quadratic modified Shepard method. The algorithm first constructs a local quadratic approximation around each data point by solving a weighted least-squares problem using nearby neighbors. These local quadratic models are then blended at the query location using a modified Shepard weighting scheme with an adaptively expanded radius. Exact interpolation is enforced at data points, while smoothness and locality are preserved elsewhere.
Syntax:
=USTCHEX_QIDW(xdat, ydat, fdat, Xq, Yq, [d])
xdat:
Range of x-coordinates of the data points (single column).
ydat:
Range of y-coordinates of the data points (single column).
fdat:
Range of observed values at the data points (single column).
Xq:
Query x-coordinate.
Yq:
Query y-coordinate.
d (Optional):
Damping and scaling parameter controlling the effective neighborhood size used in both the Franke–Nielsen local quadratic fitting and the final Shepard blending stage. Larger values increase smoothing and robustness.
Default: implementation-defined.
Returns:
A single interpolated scalar value at (Xq,Yq)(X_q,Y_q)(Xq,Yq).
Notes:
• Implements the Franke–Nielsen extension of the modified Shepard method, using local quadratic fits.
• Preserves exact interpolation at data points.
• Produces smoother and more accurate surfaces than standard IDW or linear modified Shepard methods.
• Automatically expands the blending radius if no contributing neighbors are found.
• More computationally intensive than basic IDW due to local least-squares fitting.
Example:
=USTCHEX_QIDW(A2:A80, B2:B80, C2:C80, 12.5, 7.2)
USTCHEX_QIDWGRID: Franke–Nielsen quadratic modified Shepard interpolation over a grid
Description:
Applies the same Franke–Nielsen quadratic modified Shepard formulation used by USTCHEX_QIDW to evaluate an interpolated surface over a two-dimensional grid. Local quadratic models are constructed for each data point and blended at every grid location using adaptive modified Shepard weights, producing a smooth, continuously varying field suitable for contouring and surface visualization.
Syntax:
=USTCHEX_QIDWGRID(xdat, ydat, fdat, xr, yr, [d])
xdat:
Range of x-coordinates of the data points (single column).
ydat:
Range of y-coordinates of the data points (single column).
fdat:
Range of observed values at the data points (single column).
xr:
Range containing x-grid coordinates.
yr:
Range containing y-grid coordinates.
d (Optional):
Damping and neighborhood scaling parameter controlling smoothness and robustness.
Returns:
A 2-D spill array of interpolated values, where rows correspond to yr and columns correspond to xr.
Notes:
• Uses the Franke–Nielsen quadratic modified Shepard method at every grid location.
• Produces smoother and more accurate surfaces than standard IDW and Barnes methods for well-distributed data.
• Computational cost increases with data size due to local quadratic fitting.
Example:
=USTCHEX_QIDWGRID(A2:A80, B2:B80, C2:C80, E1:N1, D2:D21)
Last edited: December 28, 2025