average

Functions

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

average [ option ] [ infile ]

  • -l int

    • number of items contained in one frame \((1 \le L)\)

  • -m int

    • order of items contained in one frame \((0 \le L - 1)\)

  • infile str

    • double-type data sequence

  • stdout

    • double-type average

The input of this command is

\[ \begin{array}{ccc} \underbrace{x_0(0), \; \ldots, \; x_0(L-1)}_L, & \underbrace{x_1(0), \; \ldots, \; x_1(L-1)}_L, & \ldots, \end{array} \]
and the output is
\[ \begin{array}{ccc} a_0, & a_1, & \ldots, \end{array} \]
where
\[ a_n = \frac{1}{L} \sum_{l=0}^{L-1} x_n(l). \]
If \(L\) is not given, the average of the whole input is computed.

ramp -l 10 | average | x2x +da
# 4.5
ramp -l 10 | average -l 5 | x2x +da
# 2
# 7
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

vsum vstat