Savitzky-Golay AlgorithmΒΆ

Savitzky-Golay algorithm performs a local polynomial regression on a given sequence of values. The basic formula (for filter width \(L = 2M+1\) and polynomial order \(k\)) is stated as follows:

\[\hat{Y}[n] = \frac{1}{2M+1} \sum_{k=-M}^M A[k] Y[n-k] \, \text{,}\]

where \(Y[n]\) and \(\hat{Y}[n]\) denote the raw and processed data sequences, respectively. The values of \(A[k]\), the Savitzky-Golay coefficient vector, depends on the choice of polynomial order \(k\). Note that the Savitzky-Golay coefficient vector can be pre-computed based on the idea to make for each point a local least-square polynomial fit.

Input Parameters

Parameter Type Constraint Description Remarks
\(Y[n]\) \(Y[n] \in \mathbb R^N\) \(N \in \mathbb{N}\) Input data sequence of length \(N\) The algorithm assumes that input values contain no outliers and improper values such as ‘nan’, ‘inf’, ‘null’.
\(L\) \(L \in \mathbb N\) \(L = 2M + 1, \quad M \in \mathbb{N}\) None None
\(k\) \(k \in \mathbb N\) None None None

Output Parameters

Parameter Type Constraint Description Remarks
\(\hat{Y}[n]\) \(\hat{Y}[n] \in \mathbb R^N\) \(N \in \mathbb{N}\) Output data sequence of length \(N\) None

Single Steps using the Algorithm


    1. Savitzky, M.J.E. Golay, Smoothing and Differentiation of Data by Simplified Least Squares Procedures, Analytical Chemistry, vol. 36, Issue 8, pp 1627-1639, 1964.
  • S.J. Orfanidis, Introduction to Signal Processing, Prentice-Hall, Englewood Cliffs, NJ, 1996.