CHAPTER 2 MATLAB EXERCISES QUESTION 1:
Enter the matrices A=[0 -4 5] and B= [-5 6 7]
3 1 -2 0 -1 2
2 1 4 4 0 -3
USE MATLAB to find a) A + B
b) B - 3A
c) AB
d) BA
QUESTION 6:
ENTER THE THREE MATRICES A= [1 2 3 4] B= [4 -6 3 5]
2 3 4 5 0 -3 -6 8
3 4 5 6 3 5 0 7
4 5 6 7 -1 0 7 9
C= [16 -1 4 -1]
-3 12 -7 8
4 -5 0 0
-14 3 2 8
a) Calculate AB-AC and A (B-C). What do you observe?
b) Calculate 3(AC), A(3C), and (3A)C. What do you observe?
Question 1
Code
A=[0 -4 5;3 1 -2;2 1 4]
B=[-5 6 7;0 -1 2;4 0 -3]
disp('(a) A+B')
A+B
disp('(b) B-3A')
B-3*A
disp('(c) AB')
A*B
disp('(d) BA')
B*A
Output
Question 6
Code
A=[1 2 3 4; 2 3 4 5; 3 4 5 6; 4 5 6 7]
B=[4 -6 3 5;0 -3 -6 8;3 5 0 7;-1 0 7 9]
C=[16 -1 4 -1;-3 12 -7 8; 4 -5 0 0;-14 3 2 8 ]
disp('(a)')
disp('AB-AC')
A*B-A*C
disp('A(B-C)')
A*(B-C)
disp('(b)')
disp('3(AC)')
3*(A*C)
disp('A(3C)')
A*(3*C)
disp('(3A)C')
(3*A)*C
Output
Get Answers For Free
Most questions answered within 1 hours.