MATLAB WEEK-1
MATLAB
Week: 1BASIC MATLAB OPERATIONS
PROBLEM:
1) Adding two matrices.
2) Subtracting two matrices.
3) Multiplying two matrices.
4) Inverse of a matrix.
5) Transpose of a matrix.
6) Adjoint of a matrix.
7) All basic matrix operations
CODE:
a=input('Enter the first matrix')
b=input('Enter the second matrix')
add=a+b
sub=a-b
multi=a*b
inverse=inv(a)
transpose=a'
adjoint=det(a)*inv(a)
division=a/b
determinant=det(a)
OUTPUT:
Enter the first matrix[1 2;4 5]
a =
1 2
4 5
Enter the second matrix[7 8;2 6]
b =
7 8
2 6
add =
8 10
6 11
sub =
-6 -6
2 -1
multi =
11 20
38 62
inverse =
-1.6667 0.6667
1.3333 -0.3333
transpose =
1 4
2 5
adjoint =
5 -2
-4 1
division =
0.0769 0.2308
0.5385 0.1154
determinant =
-3
Comments
Post a Comment