Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Median filter

The `dsp.MedianFilter`

System
object™ computes the moving median of the input signal along each channel, independently
over time. The object uses the sliding window method to compute the moving median. In this
method, a window of specified length is moved over each channel, sample by sample, and the
object computes the median of the data in the window. For more details, see Algorithms.

To compute the moving median of the input:

Create the

`dsp.MedianFilter`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

`medFilt = dsp.MedianFilter`

`medFilt = dsp.MedianFilter(Len)`

`medFilt = dsp.MedianFilter(Name,Value)`

returns a median
filter object, `medFilt`

= dsp.MedianFilter`medFilt`

, using the default properties.

sets the `medFilt`

= dsp.MedianFilter(`Len`

)`WindowLength`

property to `Len`

.

`medFilt = dsp.MedianFilter(Name,Value)`

specifies the
`WindowLength`

property using a `Name,Value`

pair.

**Example**:

`movMin = dsp.MedianFilter('WindowLength',5);`

`y = medFilt(x)`

To use an object function, specify the
System
object as the first input argument. For
example, to release system resources of a System
object named `obj`

, use
this syntax:

release(obj)

[1] Bodenham, Dean. “Adaptive Filtering and Change Detection for Streaming Data.” PH.D. Thesis. Imperial College, London, 2012.

`dsp.Median`

|`dsp.MovingAverage`

|`dsp.MovingMaximum`

|`dsp.MovingMinimum`

|`dsp.MovingRMS`

|`dsp.MovingStandardDeviation`

|`dsp.MovingVariance`