Click or drag to resize

LinearApproximationInterpolate Method (Double, Double, Double, Int32, Int32, Int32, Int32, Int32)

Interpolates a dependent value corresponding to an independent value when supplied 2 distinct independent values and at least 1 dependent value per independent value.

Namespace:  AGI.Foundation.NumericalMethods.Advanced
Assembly:  AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 24.1.418.0 (24.1.418.0)
public static double[] Interpolate(
	double x,
	double[] xTable,
	double[] yTable,
	int yStride,
	int inputOrder,
	int outputOrder,
	int startIndex,
	int length


Type: SystemDouble
The independent variable for which the dependent variables will be interpolated.
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. Only 2 values from this array will be used in the interpolation.
Type: SystemDouble
The array of dependent variables to use to interpolate. There can be multiple values corresponding to each independent values in xTable. 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}.
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.
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 dependent values, first derivatives, and second derivatives. The returned array will have the linearly interpolated values of all given orders, so the derivative of the zeroth order result data may not necessarily be the same as the values in the first order of the result data.
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 along with the dependent variable values, pass 1. If a number greater than 1 is passed, zeroes will be returned for all the derivatives past the first degree.
Type: SystemInt32
The index in xTable of the first value to use in the interpolation. The index of the first value in yTable to use is calculated as: startIndex * yStride * (inputOrder + 1)
Type: SystemInt32
The number of values to use in the interpolation. This number must be 2 for the interpolation algorithm to work correctly.

Return Value

Type: Double
An array of interpolated values along with the derivative information if indicated by outputOrder.
ArgumentOutOfRangeException Thrown when length does not equal 2, startIndex is outside the bounds of xTable, or yStride is less than or equal to zero.
ArgumentNullException Thrown when xTable or yTable is .
See Also