cumprod
The cumulative product of object's elements along a specified dimension.
Syntax
R = cumprod(x)
R = cumprod(x,dim)
Inputs
- x
- Any valid scalar | vector | matrix.
- dim
- The dimension on which to accumulate.
Outputs
- R
- The cumulative product.
Examples
Along default dimension:
cumprod([1,2,3;4,5,6])
ans = [Matrix] 2 x 3
1 2 3
4 10 18
Using row dimension:
cumprod([1,2,3;4,5,6],2)
ans = [Matrix] 2 x 3
1 2 6
4 20 120
Comments
Returns the cumulative product starting at the beginning of the first array.