Interpolation.Periodic Method

Performs periodic linear interpolation at a single point.

Definition

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

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.
period  Double
The period of the periodic function.

Return Value

Double
The interpolated y-value at x.

Remarks

This method performs linear interpolation on periodic data by wrapping x into the range [xValues[0], xValues[0] + period) and augmenting the data with a seam point.

Note: This method creates an internal PiecewiseInterpolatingCurve object for evaluation. This method should only be used for one-off calculations. For repeated evaluations on the same data, use PeriodicLinearCurve(ReadOnlySpan<Double>, ReadOnlySpan<Double>, Double) to create a reusable curve object, which will be more efficient.

Exceptions

ArgumentNullExceptionxValues or yValues is null.
ArgumentExceptionxValues and yValues have different lengths, or contain fewer than 2 elements.
ArgumentOutOfRangeExceptionperiod is not positive.

See Also