ILNumerics Ultimate VS

Interpolationinterp2s Method (InArraycomplex, InArrayDouble, InArrayDouble, InArrayDouble, InArrayDouble, InterpolationMethod)

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Interpolate scattered query points from gridded sample data in R2.

[ILNumerics Interpolation Toolbox]

Namespace:  ILNumerics.Toolboxes
Assembly:  ILNumerics.Toolboxes.Interpolation (in ILNumerics.Toolboxes.Interpolation.dll) Version: 5.5.0.0 (5.5.7503.3146)
Syntax

public static RetArray<complex> interp2s(
	InArray<complex> V,
	InArray<double> X1,
	InArray<double> X2,
	InArray<double> Xn1,
	InArray<double> Xn2,
	InterpolationMethod method = InterpolationMethod.linear
)

Parameters

V
Type: ILNumericsInArraycomplex
Known values, specified as matrix in meshgrid format.
X1
Type: ILNumericsInArrayDouble
Sample positions of grid points along the rows of V, specified as a matrix in meshgrid format or as vector, or null for auto uniform range.
X2
Type: ILNumericsInArrayDouble
Sample positions of grid points along the columns of V, specified as a matrix in meshgrid format or as vector, or null for auto uniform range.
Xn1
Type: ILNumericsInArrayDouble
Query points X-coordinates, real array of arbitrary shape.
Xn2
Type: ILNumericsInArrayDouble
Query points Y-coordinates, real array of arbitrary shape.
method (Optional)
Type: ILNumerics.ToolboxesInterpolationMethod
[Optional] Interpolation method. Default: linear

Return Value

Type: RetArraycomplex
Interpolated values at query points given in Xn1 and Xn2.
Exceptions

ExceptionCondition
ArgumentNullExceptionIf input parameter V is NULL
ArgumentExceptionIf argument X1 or X2 are found to be not strictly monotonically ascending.
ArgumentExceptionIf arguments Xn1 and Xn2 have different number of elements.
Remarks

[!:interp2s(InArray<complex>, complex?, InArray<complex>, InArray<complex>, InArray<complex>, InArray<complex>, InterpolationMethod)] performs interpolation of individual scattered points on the two-dimensional domain V. While V corresponds to a rectilinear grid with uniform or non-uniform ranges for any dimension, new query points for interpolation are scattered and not arranged in a grid. The query points for interpolation are specified dimension-wise in Xn1 and Xn2. Therefore, the number of elements in Xn1 and Xn2 must match. Xn1 specifies the coordinates in the first dimension (X coordinates) of the query points, corresponding to the direction of the rows in V. Xn2 specifies the coordinates in the second dimension (Y coordinates) of the query points, corresponding to the direction of the columns in V. None of Xn1 and Xn2 can be null.

The positions of the grid elements in V are specified in X1 for the rows in V and X2 for the columns in V. Any dimension specified as null in X1 or X2 are considered as auto-ranged with values from 0...size(V,0)-1 or 0...size(V,1)-1 correspondingly. Otherwise, X1 and X2 must be arrays with strictly monotonically increasing elements.

Any interpolation method out of the enum InterpolationMethod is supported, with the exception of polynomial and parabolic. By default, linear interpolation is performed.

Any elements outside of the domain of V are marked as NaN (not a number).

V may contain NaN values. Depending on the interpolation method used interpolated query points on surronding hypercubes will return NaN as well.

Any elements in Xn1 or Xn2 being NaN will cause the corresponding interpolation result to be considered as 'out of range: NaN will be assigned to it.

The array returned is of size 2 x n, where n corresponds to the number of elements in Xn1 and Xn2.

[ILNumerics Interpolation Toolbox]

Examples

//generate any meshgrid [-1:1]
Array<complex> Y = 1.0f;
Array<complex> X = meshgrid(linspace<double>(-1, 1, 20), linspace<double>(-1, 1, 20), Y);
Array<complex> V = sqrt(1 - X * X - Y * Y);

//define random generated scattered points [-1:1]
Array<double> Xn = 2 * rand(3000, 1) - 1;
Array<double> Yn = 2 * rand(3000, 1) - 1;

//Interpolate
Array<complex> Vq = Interpolation.interp2s(V, X1, X2, Xn1, Xn2, method:InterpolationMethod.linear, outOfRangeValues: complex.NaN);

//or spline interpolation without range definition
Array<complex> Vq = Interpolation.interp2s(V, Xn1:Xn, Xn2:Yn, method:InterpolationMethod.spline);

//this two function calls returns an empty array, because query points not set
Array<complex> Vq = Interpolation.interp2s(V, X1, X2, method:InterpolationMethod.nearest);
//or
Array<complex> Vq = Interpolation.interp2s(V);

See Also

Reference