Interpolation.MonotoneCubic Method

Performs monotone cubic spline interpolation at a single point.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
C#
public static double MonotoneCubic(
	double[] xValues,
	double[] yValues,
	double x
)

Parameters

xValues  Double[]
The x-coordinates of the data points. Must be strictly increasing.
yValues  Double[]
The y-coordinates of the data points.
x  Double
The x-coordinate at which to interpolate.

Return Value

Double
The interpolated y-value at x.

Remarks

This method creates a temporary monotone cubic spline curve object that preserves the monotonicity of the data and evaluates it at the specified point. Note: This method should only be used for one-off calculations. For repeated evaluations on the same data, use MonotoneCubicSpline(Double[], Double[]) to create a reusable curve object, which will be more efficient.

Exceptions

ArgumentNullExceptionxValues or yValues is null.
DimensionMismatchException The lengths of xValues and yValues do not match.
ArgumentExceptionxValues does not have at least 2 elements, or the values in xValues are not strictly increasing.

See Also