Multiply numbers, vectors, and matrices
multiply performs multiplication with behavior appropriate to its operands. For scalars it returns a product; for matrices it performs matrix multiplication when dimensions are compatible.
Matrix meaning
A 2-by-3 matrix can multiply a 3-by-1 vector, producing a 2-by-1 result. Check dimensions with size. Use dotMultiply for elementwise multiplication and dot for a vector dot product.
Caveats
Matrix multiplication is not commutative: A×B usually differs from B×A. Use identity for the multiplicative neutral matrix and ctranspose in complex linear algebra. Type and shape mismatches should be fixed explicitly, not hidden by flattening.