=====================
Forward Moving Median
=====================
:doc:`/WorkProcessClassifiers/LocalAlgorithm/index` - :doc:`/WorkProcessClassifiers/OneDimensionalAlgorithm/index`

*Forward Moving Median*

algorithm replaces each original data value by the *Median* value over its neighbor values. The choice of filter width has a great impact on the final results. The basic formula (for filter width :math:`L = M+1`\ ) is stated as follows:

.. math::

    \hat{x}[n] = \text{Median}\{x[n], \ldots, x[n+M]\} \, \text{,} 

where :math:`x[n]` and :math:`\hat{x}[n]` denote raw data and processed data, respectively.

.. rubric:: Input Parameters

+------------------------+------------------------------------------------+----------------------------------------------------------------+--------------------------------------------------+---------+
| Parameter              | Type                                           | Constraint                                                     | Description                                      | Remarks |
+========================+================================================+================================================================+==================================================+=========+
| :math:`x[n]`           | :math:`x[n] \in \mathbb R^N`                   | :math:`N \in \mathbb{N}`                                       | Input data sequence of length :math:`N`          |         |
+------------------------+------------------------------------------------+----------------------------------------------------------------+--------------------------------------------------+---------+
| :math:`L`              | :math:`L \in \mathbb N`                        | :math:`L = M + 1, \quad M \in \mathbb{N}`                      |                                                  |         |
+------------------------+------------------------------------------------+----------------------------------------------------------------+--------------------------------------------------+---------+

.. rubric:: Output Parameters

+--------------------------------+--------------------------------------------------------+----------------------------------------+---------------------------------------------------+---------+
| Parameter                      | Type                                                   | Constraint                             | Description                                       | Remarks |
+================================+========================================================+========================================+===================================================+=========+
| :math:`\hat{x}[n]`             | :math:`\hat{x}[n] \in \mathbb R^N`                     | :math:`N \in \mathbb{N}`               | Output data sequence of length :math:`N`          |         |
+--------------------------------+--------------------------------------------------------+----------------------------------------+---------------------------------------------------+---------+

.. rubric:: Tool Support

* :doc:`/Tools/MatlabTool/index`

.. rubric:: Single Steps using the Algorithm

* :doc:`/DataPreprocessing/DataCleaning/DataDenoising/DataDenoisingWithForwardMovingMedian/index`

.. rubric:: References

- G.R.\  Arce, Nonlinear Signal Processing: A Statistical Approach, Wiley:New Jersey, USA, 2005.