[ILNumerics Interpolation Toolbox]
Namespace: ILNumerics.Toolboxes
Assembly: ILNumerics.Toolboxes.Interpolation (in ILNumerics.Toolboxes.Interpolation.dll) Version: 5.5.0.0 (5.5.7503.3146)
public static RetArray<double> spline( InArray<double> V, Nullable<double> outOfRangeValue, InArray<double> X = null, InArray<double> Xn = null, InArray<double> lbDeriv = null, InArray<double> ubDeriv = null )
Parameters
- V
- Type: ILNumericsInArrayDouble
Sampled values as columns of a matrix or n-dimensional array. Size [n x m], n: number of points per sample set (column length), m: number of measurements. - outOfRangeValue
- Type: SystemNullableDouble
Scalar value to get assigned to all new query points laying outside of the specified domain of V. Null: extrapolate. - X (Optional)
- Type: ILNumericsInArrayDouble
[Optional] Vector with positions for values in V. Default: (null) assumes spacing of 1.0 between row elements in V. - Xn (Optional)
- Type: ILNumericsInArrayDouble
[Optional] Vector of length k with new query points to interpolate. Default: (null) create new points by subdividing the ranges from X once. - lbDeriv (Optional)
- Type: ILNumericsInArrayDouble
[Optional] Vector of length m with first derivative(s) at the lower end of each sample set. Default (null): not-a-knot spline. - ubDeriv (Optional)
- Type: ILNumericsInArrayDouble
[Optional] Vector of length m with first derivative(s) at the upper end of each sample set. Default (null): not-a-knot spline.
Return Value
Type: RetArrayDoubleArray of the same size as V, having the working dimension replaced with Xn.Length interpolated values.
Each column in V is treated as an independent set of sampled values. A piecewise cubic spline interpolation is performed for each column individually.
V can be a n-dimensional array in which case the interpolation is done on a reshaped version of V = V[":;:"]. However, all dimensions of the original V are retained and considered for the return value (shape preserving).
While the rows of V hold the ensemble of measurements for each sample position, X holds the coordinates of these positions. If X is provided it must be a vector of length n with strictly monotonically increasing values, without any duplicates. If X is not provided (null) unit spacing of the row elements in V is assumed: 0..1..2..n-1.
The parameters lbDeriv and ubDeriv control the derivatives at the lower bound and at the upper bound of the sampled domain. The default values null compute so called 'not-a-knot' splines, i.e. the 1st, 2nd and 3rd derivatives at these ends are considered equal to the corresponding derivatives at their next available inner sampled values. This corresponds to simply extending the spline function at the first and last inner samples to the end points, hence the name 'not-a-knot'.
For other options for end point derivatives see the documentation for SplineInterpolatorDouble.
The spline(InArrayDouble, NullableDouble, InArrayDouble, InArrayDouble, InArrayDouble, InArrayDouble) function serves as a wrapper for the SplineInterpolatorDouble object for syntactic convenience. Subsequent calls of spline() on the same data will recreate all temporary information necessary for the interpolation. Consider using the SplineInterpolatorDouble object directly if optimal performance for multiple interpolations based on the same dataset V is required.
Support for NaN values: spline interpolation performs interpolation by taking all values of V into account. What enables best smoothness properties on the other hand implies that any NaN value in V populate to all elements of the output. Therefore, one must ensure that no NaN values exist in V. Use cubic polynomial interpolation in interpn(InArrayDouble, InCell, InCell, InterpolationMethod) for an alternative on data with NaN values.
[ILNumerics Interpolation Toolbox]