medianSmooth

Block Category: Matrix Operation

Description: The medianSmooth block calculates the median of the input signal within the given smoothing window. The output is the smoothed signal.

Median Window: The number of elements from which the middle element is determined. The median window value must be an odd number that is greater than or equal to 3.

 

Example

The meanSmooth and medianSmooth blocks smooth a noisy input signal via a trailing mean or median with a user-defined window. The averaging window must be a positive integer (and additionally for the medianSmooth block, must be an odd number greater than three).

Near the start of the simulation the user-specified window is larger than the number of time steps (that is, the available data set); in this case, the window the block uses increases in size every time step until the number of time steps equals the user-specified window size.

Notice the meanSmooth and filter outputs are affected by the outliers, while the medianSmooth ignores them.

medianSmooth example