dsp.Median System object

Package: dsp

Median value of input


The Median object computes the median value of the input. The object can compute the median along each dimension (row or column) of the input or of the entire input.

To compute the median of the input:

  1. Define and set up your median System object™. See Construction.

  2. Call step to compute the median according to the properties of dsp.Median. The behavior of step is specific to each object in the toolbox.


H = dsp.Median returns a median System object, H, that computes the median along the columns of the input using the Quick sort sorting method.

H = dsp.Median('PropertyName',PropertyValue,...) returns a median System object, H, with each property set to the value you specify.



Sort method

Specify the method the object should use to sort the data before computing the median. You can specify Quick sort or Insertion sort. The quick sort algorithm uses a recursive sort method and is faster at sorting more than 32 elements. The insertion sort algorithm uses a nonrecursive method and is faster at sorting less than 32 elements. If you are using the Median object to generate code, you should use the insertion sort algorithm to prevent recursive function calls in your generated code. The default is Quick sort.


Dimension to operate along

Specify the dimension along which the object computes the median values. You can specify one of | All | Row | Column | Custom |. The default is Column.


Numerical dimension to operate along

Specify the dimension of the input signal (as a one-based value), over which the object computes the median. The cannot exceed the number of dimensions in the input signal. This property applies only when you set the Dimension property to Custom. The default is 1.

 Fixed-Point Properties


cloneCreate median object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs of step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
stepMedian value


Compute the median value of the input column:

 h = dsp.Median;
 x = [7 -9 0 -1 2 0 3 5 -9]';
 y = step(h, x)


This object implements the algorithm, inputs, and outputs described on the Median block reference page. The object properties correspond to the block properties, except:

Treat sample-based row input as a column block parameter is not supported by the dsp.Median System object.

Introduced in R2012a

Was this topic helpful?