100 CHAPTER 5. MATRICES
>>A=[1,2,3;5,2,7;8,2,1];B=[3,2,-5;3,11,2;-3,-1,5];C=[1,2;4,-3;7,3];D=[1,2,3;-3,2,1];This defines some matrices. Then suppose you wanted to find
(A−1DT +BC
)T. You
would then typetranspose(inv(sym(A))*transpose(D)+B*C) or (inv(sym(A))*D’+B*C)’and press enter. This givesans =[ -427/18, 4421/72, 1007/36][ -257/18, -1703/72, 451/36]In matlab, A’ means ĀT the conjugate transpose of A. Since everything is real here, this
reduces to the transpose.To get to a new line in matlab, you need to press shift enter. You can adapt this to other
situations. Notice how a ; was placed after the definition of A,B,C,D. This tells matlabthat you have defined something but not to say anything about it. If you don’t do this, thenwhen you press return, it will list the matrices and you don’t want to see that. You justwant the answer. When you have done a computation in matlab, you ought to go to >>and type “clear all” and then enter. That way, you can use the symbols again with differentdefinition. If you don’t do the “clear all” thing, it will go on thinking that A is what youdefined earlier.
5.3 Exercises1. Here are some matrices:
A =
(1 2 32 1 7
),B =
(3 −1 2−3 2 1
),
C =
(1 23 1
),D =
(−1 22 −3
),E =
(23
).
Find if possible −3A,3B−A,AC,CB,AE,EA. If it is not possible explain why.
2. Here are some matrices:
A =
1 23 21 −1
,B =
(2 −5 2−3 2 1
),
C =
(1 25 0
),D =
(−1 14 −3
),E =
(13
).
Find if possible −3A,3B−A,AC,CA,AE,EA,BE,DE. If it is not possible explainwhy.