======================== Savitzky-Golay Algorithm ======================== :doc:`/WorkProcessClassifiers/LocalAlgorithm/index` - :doc:`/WorkProcessClassifiers/OneDimensionalAlgorithm/index` *Savitzky-Golay* algorithm performs a local polynomial regression on a given sequence of values. The basic formula (for filter width :math:`L = 2M+1` and polynomial order :math:`k`\ ) is stated as follows: .. math:: \hat{Y}[n] = \frac{1}{2M+1} \sum_{k=-M}^M A[k] Y[n-k] \, \text{,} where :math:`Y[n]` and :math:`\hat{Y}[n]` denote the raw and processed data sequences, respectively. The values of :math:`A[k]`\ , the Savitzky-Golay coefficient vector, depends on the choice of polynomial order :math:`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. .. rubric:: Input Parameters +------------------------+------------------------------------------------+----------------------------------------------------------------+--------------------------------------------------+---------------------------------------------------------------------------------------------------------------+ | Parameter | Type | Constraint | Description | Remarks | +========================+================================================+================================================================+==================================================+===============================================================================================================+ | :math:`Y[n]` | :math:`Y[n] \in \mathbb R^N` | :math:`N \in \mathbb{N}` | Input data sequence of length :math:`N` | The algorithm assumes that input values contain no outliers and improper values such as 'nan', 'inf', 'null'. | +------------------------+------------------------------------------------+----------------------------------------------------------------+--------------------------------------------------+---------------------------------------------------------------------------------------------------------------+ | :math:`L` | :math:`L \in \mathbb N` | :math:`L = 2M + 1, \quad M \in \mathbb{N}` | | | +------------------------+------------------------------------------------+----------------------------------------------------------------+--------------------------------------------------+---------------------------------------------------------------------------------------------------------------+ | :math:`k` | :math:`k \in \mathbb N` | | | | +------------------------+------------------------------------------------+----------------------------------------------------------------+--------------------------------------------------+---------------------------------------------------------------------------------------------------------------+ .. rubric:: Output Parameters +--------------------------------+--------------------------------------------------------+----------------------------------------+---------------------------------------------------+---------+ | Parameter | Type | Constraint | Description | Remarks | +================================+========================================================+========================================+===================================================+=========+ | :math:`\hat{Y}[n]` | :math:`\hat{Y}[n] \in \mathbb R^N` | :math:`N \in \mathbb{N}` | Output data sequence of length :math:`N` | | +--------------------------------+--------------------------------------------------------+----------------------------------------+---------------------------------------------------+---------+ .. rubric:: Tool Support * :doc:`/Tools/MatlabTool/index` For details refer to the online documentation of the function `'sgolayfilt' `__. .. rubric:: Single Steps using the Algorithm * :doc:`/DataPreprocessing/DataCleaning/DataDenoising/DataDenoisingWithSavitzkyGolaySmoothing/index` .. rubric:: References - A.\ 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.