dot
Vector or array dot product.
Syntax
Section titled “Syntax”C = dot(A, B)C = dot(A, B, dim)Description
Section titled “Description”Returns the scalar dot product of vectors A and B, or — when A and B are matrices — a row vector of column-wise dot products. With the optional dim, takes dot products along that dimension. A and B must have the same dimensions.
Examples
Section titled “Examples”dot([1 2 3], [4 5 6]) % 32 (1*4 + 2*5 + 3*6)dot([1 2; 3 4], [5 6; 7 8]) % [26 44] per-columndot([1 2; 3 4], [5 6; 7 8], 2) % [17; 53] per-row