Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

dsp.Median System object

Package: dsp

Median value of input

Description

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.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Construction

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.

Properties

SortMethod

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

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.

CustomDimension

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

Methods

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

Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Compute the median value of the input column using the dsp.Median object.

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

     0

Algorithms

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?