23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2cumprod<br />

Purpose Cumulative product<br />

Syntax B = cumprod(A)<br />

B = cumprod(A,dim)<br />

cumprod<br />

Description B = cumprod(A) returns the cumulative product along different dimensions of<br />

an array.<br />

If A is a vector, cumprod(A) returns a vector containing the cumulative product<br />

of the elements of A.<br />

If A is a matrix, cumprod(A) returns a matrix the same size as A containing the<br />

cumulative products for each column of A.<br />

If A is a multidimensional array, cumprod(A) works on the first nonsingleton<br />

dimension.<br />

B = cumprod(A,dim) returns the cumulative product of the elements along the<br />

dimension of A specified by scalar dim. For example, cumprod(A,1) increments<br />

the first (row) index, thus working along the rows of A.<br />

Examples cumprod(1:5)<br />

ans =<br />

1 2 6 24 120<br />

A = [1 2 3; 4 5 6];<br />

cumprod(A)<br />

ans =<br />

1 2 3<br />

4 10 18<br />

cumprod(A,2)<br />

ans =<br />

1 2 6<br />

4 20 120<br />

See Also cumsum, prod, sum<br />

2-353

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!