Cumulative product

returns
the cumulative product of `B`

= cumprod(`A`

)`A`

starting at the beginning
of the first array dimension in `A`

whose size does
not equal 1.

If

`A`

is a vector, then`cumprod(A)`

returns a vector containing the cumulative product of the elements of`A`

.If

`A`

is a matrix, then`cumprod(A)`

returns a matrix containing the cumulative products for each column of`A`

.If

`A`

is a multidimensional array, then`cumprod(A)`

acts along the first nonsingleton dimension.

Many cumulative functions in MATLAB

^{®}support the`'reverse'`

option. This option allows quick directional calculations without needing a flip or reflection of the input array.