# 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.

Also this cumulative multplication is done for each columns of matrices. All the columns and their elements are cumulatively multiplicated. Then the result is a matrix that includes all the cumulative multiplications of column elements.

YOU CAN LEARN MatLab IN MECHANICAL BASE; Click And Start To Learn MatLab!

You can also type the matrix or vector variable inside ‘cumprod()’ command, as in example ‘c’ above.

The use of ‘cumprod()’ command is like above generally in Matlab. Do not forget to leave your comments and questions about calculating cumulative multiplications with ‘cumprod()’ command in Matlab below.

Your precious feedbacks are very important for us.

Posted

in

by