Engee documentation

Median

The median of the input data.

median

Description

The Median block calculates the median of each row, column or vector of a given dimension of the input data. The block can also calculate the median of the entire input signal. The dimensionality can be set using the Find the median value over parameter.

When calculating the median, the block first sorts the input values. If the number of values is odd, the median value will be the middle value. If the number of values is even, the median will be the average of the two middle values.

Ports

Input

Port_1 - data input
vector | matrix

The block accepts multichannel and multidimensional input data with real or complex value. The input data type must be double precision, single precision, integer, slope to the power of two and zero offset.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128.

Support for complex numbers: Yes

Output

Port_1 - average value of the specified measurement
vector | matrix

The block calculates the median value in each row or column of the input data or along vectors of the specified dimension of the input data. It can also compute the median of the entire input signal. Each element in the output array y is the median value of the corresponding column, row, or the entire input signal. The output array y depends on the setting of the Find the median value over parameter.

Consider a three-dimensional input signal of size M by N by P. When you set the Find the median value over parameter to:

  • Entire input - the output at each sampling point is a scalar containing the median value of the M by N by P input matrix.

  • Each row - the output at each sampling time consists of an M by 1 array on P, where each element contains the median value of each vector on the second dimension of the input data. For an M by N matrix input, the output is the M by 1 column vector.

  • Each column - the output data at each sampling time consists of an array of size 1 by N by P, where each element contains the median value of each vector along the first dimension of the input data. For an input matrix of size M by N, the output at each sampling instant is a vector of rows of size 1 by N.

    In this mode, the block processes the input data of undirected vectors of length M as vectors of columns of size M by 1.

  • Specified dimension - the output data at each calculation step depends on the value of the Dimension parameter.

    • If you set the Dimension parameter to 1, the output will be the same as when you select each column.

    • If you set the Dimension parameter to 2, the output will be the same as when you select each row.

    • If you set Dimension to 3, the output at each sampling point will be an M by N matrix containing the median value of each vector along the third dimension of the input data.

The output data type corresponds to the input data type.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128.

Support for complex numbers: Yes

Parameters

Main

Find the median value over - the dimension on which the median is calculated
Quick sort (by default) | Insertion sort
  • Each column - block outputs the median value for each column.

  • Each row - the block outputs the median value for each row.

  • Entire input - block outputs the median value for the whole input.

  • Specified dimension - the block outputs the median value for the dimension specified in the Dimension parameter.

Dimension - custom dimension
1 (By default) | scalar.

Specify the dimension (unit-based value) of the input signal from which the block calculates the median. The value of this parameter must be greater than 0 and less than or equal to the number of dimensions in the input signal.

Dependencies

To use this parameter, set Find the median value over to `Specified dimension'.