MATLAB Function Reference
  Go to function:
    Search    Help Desk 
cumprod    Examples   See Also

Cumulative product

Syntax

Description

B = cumprod(A) returns the cumulative product along different dimensions of an array.

If A is a vector, cumprod(A) returns a vector containing the cumulative product of the elements of A.

If A is a matrix, cumprod(A) returns a matrix the same size as A containing the cumulative products for each column of A.

If A is a multidimensional array, cumprod(A) works on the first nonsingleton dimension.

B = cumprod(A,dim) returns the cumulative product of the elements along the dimension of A specified by scalar dim. For example, cumprod(A,1) increments the first (row) index, thus working along the rows of A.

Examples

See Also

cumsum      Cumulative sum

prod        Product of array elements

sum         Sum of array elements



[ Previous | Help Desk | Next ]