sumproduct
Sum of element-wise products of arrays.
Syntax
Section titled “Syntax”v = sumproduct(array1, array2, ...)Description
Section titled “Description”Returns sum(array1 .* array2 .* ...) — the dot product / element-wise product summed. Arrays must have the same shape.
Examples
Section titled “Examples”sumproduct([1 2 3], [4 5 6]) % 32sumproduct([1 0 1; 0 1 1], [1 2 3; 4 5 6]) % 1+0+3+0+5+6 = 15