# Cumulative Multiplication Of Vectors And Matrices In MatLab

Like cumulative summation, you can also make your cumulative multiplications of matrices and vectors in Matlab. Cumulative multiplication is also very important method to evaluate datas or statistics. You make your cumulative multiplications with ‘cumprod()’ command in Matlab.

Cumulative multiplications is the multiplications of numbers or elements sets, up to a specified element.

In here, we explain how to make cumulative multiplications with ‘cumprod()’ command in Matlab.

## How To Use ‘cumprod()’ Command In MatLab?

``````>> a = cumprod([5 2 3 6])
b = cumprod([2 6 4 3; 1 6 1 6; 4 6 2 6])
c = [1 3 5;4 4 6; 4 6 3];
d = cumprod(c)

a =

5    10    30   180

b =

2     6     4     3
2    36     4    18
8   216     8   108

d =

1     3     5
4    12    30
16    72    90``````

The codes above are the examples of ‘cumprod()’ command in Matlab in Command Window. As you see above example, the use of ‘cumprod()’ command is very simple. What you need to do is, just write the vector or matrix inside the parantheses of ‘cumprod()’ command.

The logic of cumulative multiplications is very straightforward for vectors. All the elements are multiplied with other elements before them, then a resultant vector is created with these all results for elements, as you see the answer ‘a’ above.