Click or drag to resize

InterpolatorInterpolateWithDegree Method

Interpolates values using this interpolation algorithm. The appropriate subset of input values to use for the interpolation is determined automatically from an interpolation given degree.

Namespace:  AGI.Foundation.NumericalMethods.Advanced
Assembly:  AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 24.2.419.0 (24.2.419.0)
Syntax
public double[] InterpolateWithDegree(
	double x,
	double[] xTable,
	double[] yTable,
	int degree,
	int yStride,
	int inputOrder,
	int outputOrder
)

Parameters

x
Type: SystemDouble
The independent variable for which the dependent variables will be interpolated.
xTable
Type: SystemDouble
The array of independent variables to use to interpolate. The values in this array must be in increasing order and the same value must not occur twice in the array.
yTable
Type: SystemDouble
The array of dependent variables to use to interpolate. For a set of three dependent values (p,q,w) and their derivatives (dp, dq, dw) at time 1 and time 2 this should be as follows: {p1, q1, w1, dp1, dq1, dw1, p2, q2, w2, dp2, dq2, dw2}.
degree
Type: SystemInt32
The degree of interpolation to perform. For Linear Interpolation, this value should be 1.
yStride
Type: SystemInt32
The number of dependent variable values in yTable corresponding to each independent variable value in xTable. If inputOrder is greater than 0, this is also the number of first derivative values, second derivative values, etc. corresponding to each value in xTable.
inputOrder
Type: SystemInt32
The number of dependent variable derivatives in yTable. If this value is 0, the yTable is assumed to contain only dependent variable values, with each yStride of them corresponding to a single independent variable in the xTable. If this value is 1, the yTable is assumed to contain not only the dependent variable values but also their derivatives. There are yStride dependent variable values followed by yStride dependent variable first derivatives corresponding to each independent variable value in xTable. Similarly, if this value is 2, the yTable contains values, first derivatives, and second derivatives.
outputOrder
Type: SystemInt32
The number of derivatives to return. To return just the dependent variable values, pass 0 for this parameter. To return the first derivatives as well, pass 1. To retrieve the second derivatives as well, pass 2. Note that not all interpolation algorithms are capable of returning second derivative information, and if a higher outputOrder is requested than the algorithm is able to provide, the highest order derivative will be returned and the request for the higher order derivatives is ignored.

Return Value

Type: Double
An array of interpolated values. The array contains at least yStride elements, each of which is an interpolated dependent variable value. If outputOrder is 1 or greater, the array contains an additional yStride elements, each of which is an interpolated dependent variable first derivative. Lastly, if outputOrder is 2 or greater, the array contains another additional yStride elements, each of which is an interpolated variable second derivative.
Remarks
The xTable array can contain any number of elements, and the appropriate subset will be selected according to the degree of interpolation requested. For example, if degree is 5, the 6 elements surrounding x will be used for interpolation. When using LinearApproximation, the degree should be 1 since it always deals with only 2 elements surrounding x. The yTable array should contain a number of elements equal to: xTable.Length.Length * yStride * (inputOrder + 1) If insufficient elements are provided to perform the requested degree of interpolation, the highest possible degree of interpolation will be performed.
See Also