ILNumerics Ultimate VS

Interpolationinterp3s Method (InArraySingle, InArraySingle, InArraySingle, InArraySingle, InArraySingle, InArraySingle, InArraySingle, InterpolationMethod)

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

[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<float> interp3s(
	InArray<float> V,
	InArray<float> X1,
	InArray<float> X2,
	InArray<float> X3,
	InArray<float> Xn1,
	InArray<float> Xn2,
	InArray<float> Xn3,
	InterpolationMethod method = InterpolationMethod.linear
)

Parameters

V
Type: ILNumericsInArraySingle
Known values, specified as 3D array in meshgrid format.
X1
Type: ILNumericsInArraySingle
Sample positions of grid points along the rows of V, specified as a 3D array in meshgrid format or as grid 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.
X3
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.
Xn3
Type: ILNumericsInArraySingle
Query points Z-coordinates, real array of arbitrary shape.
method (Optional)
Type: ILNumerics.ToolboxesInterpolationMethod
[Optional] Interpolation method. Default: linear

Return Value

Type: RetArraySingle
Interpolated values at query points given in Xn1, Xn2 and Xn3.
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

interp3s(InArraySingle, NullableSingle, InArraySingle, InArraySingle, 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, Xn2 and Xn3. Therefore, the number of elements in Xn1, Xn2 and Xn3 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. Xn3 defines the Z coordinates. None of Xn1, Xn2 and Xn3 can be null.

The positions of the grid elements in V are specified as grid vectors in X1 for the rows in V and X2/ X3 for the columns / 3rd dimension in V. Any dimension i specified as null in X1.. X3 are considered as auto-ranged with values from 0...size(V,i)-1 correspondingly. Otherwise, X1 ... X3 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 or Xn3 being NaN will cause the corresponding interpolation result to be considered as 'out of range: NaN will be assigned to it.

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

The array returned is of size 3 x l, where l corresponds to the number of query points provided in Xn1 ... Xn3.

[ILNumerics Interpolation Toolbox]

Examples

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

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

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

//or spline interpolation without range definition
Array<float> 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<float> Vq = Interpolation.interp2s(V, X1, X2, method:InterpolationMethod.nearest);
//or
Array<float> Vq = Interpolation.interp2s(V);

See Also

Reference