MedianΒΆ

For a set of ordered data values, the following formulas are used to compute the Median value:

\[m = Y_{\frac{N+1}{2}}, \quad \text{for odd values of } N\]
\[m = \frac{Y_{\frac{N}{2}} + Y_{\frac{N}{2} + 1}}{2}, \quad \text{for even values of } N\]

where \(Y\) is the input data vector and must be ordered. In case \(Y\) is not ordered, a sorting algorithm is required. \(N\) is the length of the data vector and \(m\) represents the computed median value.

Input Parameters

Parameter Type Constraint Description Remarks
\(Y\) \(Y \in \mathbb R^N\) \(N \in \mathbb{N}\) Input data vector of length \(N\) None

Output Parameters

Parameter Type Constraint Description Remarks
\(m\) \(m \in \mathbb R\) None Median value of \(Y\) The result is sensitive to improper values such as ‘nan’, ‘inf’, ‘null’, etc.

Single Steps using the Algorithm