Write a MATLAB program for matrix addition subtraction multiplication
Write a MATLAB program for
B = [2 2 3; 4 0 6;
8 15]
C = [1 1
2; 6 3 5; 1 9 1]
Calculate:
(a)
D = B
-C
(b)
E = B
+C
(c)
F=E+2
(d)
G=B*C
(e)
H=B.*C
Code:
clc;
clear;
B = [2 2 3; 4 0 6; 8 1
5];
C = [1 1 2; 6 3 5; 1 9
1];
disp('B'); disp(B);
disp('C'); disp(C);
D = B - C; disp('D = B - C'); disp(D);
E = B + C; disp('E = B + C'); disp(E);
F= E+2; disp('F = E + 2'); disp(F);
G=B*C; disp('G = B * C'); disp(G);
H= B.*C; disp('H = B .* C'); disp(H);
Leave a Comment