sum - Sum of array elements

Syntax

b = sum(a)
b = sum(a, dim)

Description

b = sum(a) returns the sum along different dimensions of the fi array a.

If a is a vector, sum(a) returns the sum of the elements.

If a is a matrix, sum(a) treats the columns of a as vectors, returning a row vector of the sums of each column.

If a is a multidimensional array, sum(a) treats the values along the first nonsingleton dimension as vectors, returning an array of row vectors.

b = sum(a, dim) sums along the dimension dim of a.

The fimath object is used in the calculation of the sum. If SumMode is FullPrecision, KeepLSB, or KeepMSB, then the number of integer bits of growth for sum(a) is ceil(log2(length(a))).

sum does not support fi objects of data type Boolean.

See Also

add, divide, fi, fimath, mpy, numerictype, sub

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS