Finding product product of elements in a vector

조회 수: 18 (최근 30일)
MG
MG 2015년 11월 28일
답변: Image Analyst 2015년 11월 28일
I am using a vector whose length I want to vary. So supposing the vector is x = [f(1), f(2), f(3), ..... f(n)]. How do I find the product of all these entries multiplied with each other? I don't want to use cumprod because it gives me a vector output, but I only want the scalar output where the final answer is a product of all the entries.

채택된 답변

Image Analyst
Image Analyst 2015년 11월 28일
Use the prod function
theProduct = prod(yourVector);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by