Prev Next colavg

Column-wise Average Value of A Matrix
Syntax y = colavg(x)
Include: include spt\colavg.oms
See Also

ARGUMENTS:  
   INPUTS:
      x = MATRIX, any numerical type.  
   RETURN: VECTOR, DOUBLE, column-wise average.

Description

Column-wise average value of matrix Returns a row vector with the column-wise average value of matrix input. Each element of the returned vector is the average value of the corresponding column. Output is of same type as input except for INTEGER input which is coerced to DOUBLE before processing. COMPLEX inputs return COMPLEX outputs.

Example

For vectors:

O>x={0,1,2,3,4,5}
O>colavg(x)
2.5

For matrices:

O>A={[1,2], [3,4]}
O>A
{
[ 1 , 2 ]
[ 3 , 4 ]
}

O>colavg(A)
[ 2 , 3 ]