ILNumerics Ultimate VS

Interpolationinterp2s Method (InArrayfcomplex, Nullablefcomplex, InArraySingle, InArraySingle, InArraySingle, InArraySingle, 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<fcomplex> interp2s(
	InArray<fcomplex> V,
	Nullable<fcomplex> outOfRangeValues,
	InArray<float> X1,
	InArray<float> X2,
	InArray<float> Xn1,
	InArray<float> Xn2,
	InterpolationMethod method = InterpolationMethod.linear
)

Parameters

V
Type: ILNumericsInArrayfcomplex
Known values, specified as matrix in meshgrid format.
outOfRangeValues
Type: SystemNullablefcomplex
Fixed value for query points outside of the domain of V or null for extrapolation.
X1
Type: ILNumericsInArraySingle
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: ILNumericsInArraySingle
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: ILNumericsInArraySingle
Query points X-coordinates, real array of arbitrary shape.
Xn2
Type: ILNumericsInArraySingle
Query points Y-coordinates, real array of arbitrary shape.
method (Optional)
Type: ILNumerics.ToolboxesInterpolationMethod
[Optional] Interpolation method. Default: linear

Return Value

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

ExceptionCondition
ArgumentNullExceptionIf input parameter V is null.
ArgumentExceptionIf argument X1 or X2 are not strictly monotonically increasing.
ArgumentExceptionIf arguments Xn1 and/or Xn2 are null or have different sizes.
Remarks

interp2s(InArrayfcomplex, Nullablefcomplex, InArraySingle, InArraySingle, InArraySingle, InArraySingle, 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.

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: the value given in outOfRangeValues will be assigned to it. If outOfRangeValues is null those elements are mapped to the first grid element in V.

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 a meshgrid [-1:1]
Array<fcomplex> Y = 1.0f;
Array<fcomplex> X = meshgrid(linspace<float>(-1, 1, 20), linspace<float>(-1, 1, 20), Y);
Array<fcomplex> V = sqrt(1 - X * X - Y * Y);

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

//Linear interpolation
Array<fcomplex> Vq = Interpolation.interp2s(V, X1, X2, Xn1, Xn2, outOfRangeValues: fcomplex.NaN);

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

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

See Also

Reference