| MATLAB Function Reference | ![]() |
Syntax
Description
C = A*B is the linear algebraic product of the matrices A and B. If A is an m-by-p and B is a p-by-n matrix, the i,j entry of C is defined by
The product C is an m-by-n matrix. For nonscalar A and B, the number of columns of A must equal the number of rows of B. You can multiply a scalar by a matrix of any size.
The preceding definition says that C(i,j) is the inner product of the ith row of A with the jth column of B. You can write this definition using the MATLAB colon operator as
where A(i,:) is the ith row of A and B(:,j) is the jth row of B.
Note
If A is an m-by-0 empty matrix and B is a 0-by-n empty matrix, where m and n are positive integers, A*B is an m-by-n matrix of all zeros.
|
Example 1
If A is a row vector and B is a column vector with the same number of elements as A, A*B is simply the inner product of A and B. For example,
Example 2
Note that the second row of A is
while the third column of B is
The inner product of A(2,:) and B(:,3) is
Algorithm
mtimes uses the following Basic Linear Algebra Subroutines (BLAS):
For inputs of type single, mtimes using corresponding routines that begin with "S" instead of "D".
See Also
| msgbox | mu2lin | ![]() |
© 1994-2005 The MathWorks, Inc.