| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
B = cumprod(A)
B = cumprod(A,dim)
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 column index, thus working along the columns of A. Thus, cumprod(A,1) and cumprod(A) will return the same thing. To increment the row index, use cumprod(A,2).
cumprod(1:5)
ans =
1 2 6 24 120
A = [1 2 3; 4 5 6];
cumprod(A,1)
ans =
1 2 3
4 10 18
cumprod(A,2)
ans =
1 2 6
4 20 120![]() | ctranspose (timeseries) | cumsum | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |