Median Filter
Median filter.
Description
The Median Filter block calculates the moving median of the input signal for each channel independently over time. The block uses the sliding window method to calculate the moving median. In this method, a window of a given length is moved across each channel sample by sample, and the block calculates the median of the data in the window. This block performs median filtering on the input data over time.
Ports
Input
Port_1 - data input
vector-column
| vector-line
| matrix
The data from which the block calculates the moving median. The block accepts real or complex multichannel and multidimensional input data, i.e. input data of dimension to , where and .
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, Int128
, UInt8
, UInt16
, UInt32
, UInt64
, UInt128
.
Support for complex numbers: Yes
Parameters
Window length - sliding window length
5 (by default)
| positive scalar integer
Window length defines the length of the sliding window in samples.
Algorithms
Sliding window method
In the sliding window method, the output for each input sample is the median of the current sample and previous samples. - is the length of the window in samples.
To compute the first output data , when there is not yet enough data in the window, the algorithm fills the window with zeros. As an example, to compute the median value when the second input sample arrives, the algorithm fills the window with zeros. The data vector, , then represents two data samples followed by zeros. This object performs median filtering on the input data over time.
Consider an example of computing the sliding median of streaming input data using the sliding window method. The algorithm uses a window of length 4
. With each incoming input sample, the window of length 4
is moved along the data.