Smoothing.SavitskyGolaySmoother Method

Returns a delegate that Applies a Savitsky-Golay filter to a signal.

Definition

Namespace: Extreme.Mathematics.SignalProcessing
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
public static Func<Vector<double>, Vector<double>> SavitskyGolaySmoother(
	int windowLength,
	int order,
	int derivative = 0,
	Padding padding = Padding.None,
	double paddedValue = 0
)

Parameters

windowLength  Int32
The length of the smoothing window. Must be odd.
order  Int32
The order of the local polynomial.
derivative  Int32  (Optional)
(Optional.) The order of the derivative. The default is 0.
padding  Padding  (Optional)
(Optional.) Specifies how the signal is padded for calculations near the lower and upper bounds. The default value is None.
paddedValue  Double  (Optional)
(Optional.) If padding is Constant, the value to use for padding; ignored otherwise.

Return Value

Func<Vector<Double>, Vector<Double>>
A delegate that takes a signal vector as input and returns the filtered signal.

Remarks

This method returns a delegate that smooths a signal by fitting a regression polynomial of degree order to a local neighbourhood of windowLength points around each data point and replacing its value with the value of the polynomial. Optionally, a smoothed derivative of the signal may be computed.

The padding argument determines how calculations will be performed near the boundaries of the signal. The default value, None, indicates that the signal is not padded. Instead, the same polynomial using the first or last windowLength points will be used to compute the first and last few smoothed values.

The coefficients are pre-computed. This makes creating a smoother more efficient when multiple signals have to be smoothed with the same smoothing parameters

Exceptions

ArgumentOutOfRangeException

windowLength is less than zero.

-or-

order is less than zero.

-or-

derivative is less than zero or greater than the polynomial order.

ArgumentExceptionwindowLength is less than or equal to order.

See Also