Professional Documents
Culture Documents
Basic Arithmetic Operation On Matrixs
Basic Arithmetic Operation On Matrixs
Basic Arithmetic Operation On Matrixs
clc;
clear all;
B= [1 2 3;4 5 6;7 8 9];
A= [6 5 2;4 4 5;2 1 3];
disp('A=');
disp(A);
disp('B=');
disp(B);
%MATRIX ADDITION
C= A+B;
disp('The addition of Two input A and B is=');
disp(C);
%MATRIX SUBTRACTION
D= A-B;
disp('The subtraction of Two input A and B is=');
disp(D);
%MATRIX MULTIPLICATION
E= A*B;
disp('The Multiplication of Two input A and B is=');
disp(E);
%MATRIX DIVISION
F= A/B;
disp('The Division of A by B is=');
disp(F);
% MATRIX DIVISION
G= A*inv(B);
disp('The Division of A by B is=');
disp(G);
%MATRIX INVERSION
H=inv(A);
disp('Inverse of Matrix A=');
disp(H);
% DETERMINANT OF A MATRIX
I=det(A);
disp('Determinant of matrix A=');
disp(I);
A=
6 5 2
4 4 5
2 1 3
B=
1 2 3
4 5 6
7 8 9
7 7 5
8 9 11
9 9 12
5 3 -1
0 -1 -1
-5 -7 -6
40 53 66
55 68 81
27 33 39
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =
1.156482e-18.
> In basicmatrixoprn at 23
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =
1.541976e-18.
> In basicmatrixoprn at 27
1.0e+16 *
Inverse of Matrix A=
Determinant of matrix A=
24.0000
6 5 2 1 2 3
4 4 5 4 5 6
2 1 3 7 8 9
Vertical Concatenation of matrix A and B is
6 5 2
4 4 5
2 1 3
1 2 3
4 5 6
7 8 9