Page 125 - Numerical Analysis Using MATLAB and Excel
P. 125
Special Forms of Matrices
eye(4)% Display a 4 by 4 identity matrix
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
Likewise, the eye(size(A)) function, produces an identity matrix whose size is the same as
matrix . For example, let be defined as
A
A
A=[1 3 1; −2 1 −5; 4 −7 6] % Define matrix A
A =
1 3 1
-2 1 -5
4 -7 6
then,
eye(size(A))
displays
ans =
1 0 0
0 1 0
0 0 1
T
†The transpose of a matrix , denoted as A , is the matrix that is obtained when the rows and
A
columns of matrix are interchanged. For example, if
A
1 4
T
A = 123 then A = 2 5 (4.9)
45 6
3 6
In MATLAB we use the apostrophe (′) symbol to denote and obtain the transpose of a matrix.
Thus, for the above example,
A=[1 2 3; 4 5 6] % Define matrix A
A =
1 2 3
4 5 6
Numerical Analysis Using MATLAB® and Excel®, Third Edition 4−7
Copyright © Orchard Publications