Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Definite product in matlab

  1. Mar 19, 2012 #1
    Can someone tell me how to do the following in matlab (R2010a):


    thanx in advance.
  2. jcsd
  3. Mar 20, 2012 #2


    User Avatar
    Science Advisor
    Gold Member

    I assume that you have already defined the contents of the vector f of length n.
    p = prod(f);
  4. Mar 21, 2012 #3
    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)

    Please help.
  5. Mar 21, 2012 #4


    User Avatar
    Science Advisor
    Gold Member

    Read Matlab's Help entry, which tells you exactly how to take the product over a desired dimension (index). I will help you if you're stuck, but I will not do all your work for you.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?