median

Functions

int main(int argc, char *argv[])

median [ option ] [ infile ]

  • -l int

    • length of vector \((1 \le L)\)

  • -m int

    • order of vector \((0 \le L - 1)\)

  • -t int

    • output interval \((1 \le T)\)

  • infile str

    • double-type vectors

  • stdout

    • double-type median

The input of this command is

\[ \begin{array}{ccc} \underbrace{x_1(1), \; \ldots, \; x_1(L)}_L, & \underbrace{x_2(1), \; \ldots, \; x_2(L)}_L, & \ldots, \end{array} \]
and the output is
\[ \begin{array}{ccc} \underbrace{m_{0}(1), \; \ldots, \; m_{0}(L)}_L, & \underbrace{m_{T}(1), \; \ldots, \; m_{T}(L)}_L, & \ldots, \end{array} \]
where \(m_t(l)\) is the median value of \(\left\{ x_{t+\tau}(l) \right\}_{\tau=1}^T\). If \(T\) is not given, the median of the whole input is computed.

# The number of input is even:
echo 0 1 2 3 4 5 | x2x +ad | median | x2x +da
# 2.5
# The number of input is odd:
echo 0 1 2 3 4 5 | x2x +ad | median | x2x +da
# 3
echo 0 1 2 3 4 5 | x2x +ad | median -t 3 | x2x +da
# 1
# 4
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

vstat medfilt