# Definite product in matlab

1. ### dunyali

2
Can someone tell me how to do the following in matlab (R2010a):

f(1)*f(2)*...*f(n)

2. ### marcusl

2,138
I assume that you have already defined the contents of the vector f of length n.
Then
p = prod(f);

3. ### dunyali

2
Hi, marcusl

I have a 4d matrix M, with size: a * b * c * n
This is exactly what I want: M(:,:,:,1).*M(:,:,:,2).*....*M(:,:,:,n) (this is element wise multiplication of the elements)