Graphics Programs Reference
In-Depth Information
Matrices
A matrix is a rectangular array of numbers. Row and column vectors, which
we discussed above, are examples of matrices. Consider the 3 × 4 matrix
1234
5678
9101112
.
A =
It can be entered in MATLAB withthe command
>> A = [1, 2, 3, 4; 5, 6, 7, 8; 9, 10, 11, 12]
A=
1 2 3 4
5 6 7 8
9 0 1 2
Note that the matrix elements in any row are separated by commas, and the
rowsareseparatedbysemicolons.Theelementsinarowcanalsobeseparated
by spaces.
If two matrices A and B are the same size, their (element-by-element) sum
is obtained by typing A+B . You can also add a scalar (a single number) to a
matrix; A+c adds c to eachelement in A . Likewise, A-B represents the
difference of A and B , and A-c subtracts the number c from eachelement
of A .If A and B are multiplicatively compatible (that is, if A is n × m and B is
m × ), then their product A*B is n × . Recall that the element of A*B in the
i throw and j th column is the sum of the products of the elements from the
i throw of A times the elements from the j thcolumn of B , that is,
m
( A B ) ij =
A ik B kj , 1 i n , 1 j .
k = 1
The product of a number c and the matrix A is given by c*A , and A' represents
the conjugate transpose of A . (For more information, see the online help for
ctranspose and transpose .)
A simple illustration is given by the matrix product of the 3 × 4 matrix A
above by the 4 × 1 column vector Z' :
>> A*Z'
ans =
60
140
220
Search WWH ::




Custom Search