STK Components for .NET 2021 r1

## LagrangePolynomialApproximationInterpolate Method |

Interpolates values using this interpolation algorithm.

Syntax

public static double[] Interpolate( double x, double[] xTable, double[] yTable, int yStride, int inputOrder, int outputOrder, int startIndex, int length )

- 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. 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}. - 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 dependent 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 along with the dependent variable values, pass 1. A Lagrange polynomial has length-1 non-zero derivatives. This algorithm bases the derivation off of the highest input order, so, for example, if you passed in an inputOrder of 2 and a length of 4, the output from zeroth order to fifth order would be nonzero. - startIndex
- 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) - length
- Type: SystemInt32

The number of values to use in the interpolation. This value should be one more than the desired interpolation degree. For example for 7th degree interpolation, this parameter should be 8.

An array of interpolated values. The array contains at least yStride elements, each of which is an interpolated dependent variable value. If outputOrder is greater than zero, the array contains an additional number of yStride elements, for each output order.

Exceptions

Exception | Condition |
---|---|

ArgumentNullException | Thrown when xTable or yTable is . |

Remarks

The xTable array should contain one more than the desired interpolation degree.
For example, for a 7th degree interpolation, xTable should contain 8 elements.
The yTable array should contain a number of elements equal to:
xTable.Length.Length * yStride * (inputOrder + 1)

See Also