Mathematics |
Multiplying Matrices
Multiplication of matrices is defined in a way that reflects composition of the underlying linear transformations and allows compact representation of systems of simultaneous linear equations. The matrix product C = AB is defined when the column dimension of A is equal to the row dimension of B, or when one of them is a scalar. If A is m-by-p and B is p-by-n, their product C is m-by-n. The product can actually be defined using MATLAB for
loops, colon
notation, and vector dot products.
MATLAB uses a single asterisk to denote matrix multiplication. The next two examples illustrate the fact that matrix multiplication is not commutative; AB is usually not equal to BA.
A matrix can be multiplied on the right by a column vector and on the left by a row vector.
Rectangular matrix multiplications must satisfy the dimension compatibility conditions.
C = fix(10*rand(3,2)); X = A*C X = 17 19 31 41 51 70 Y = C*A Error using ==> * Inner matrix dimensions must agree.
Anything can be multiplied by a scalar.
Vector Products and Transpose | The Identity Matrix |
© 1994-2005 The MathWorks, Inc.