Smoothing.SavitskyGolay Method

Applies a Savitsky-Golay filter to the specified signal.

Definition

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

Parameters

signal  Vector<Double>
The signal to filter.
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

Vector<Double>
The filtered signal.

Remarks

This method 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. The window length m 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.

Exceptions

ArgumentNullException

signal is null.

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