Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Date: 09/08/2014

Course No. EEE 212


Group No.



Name Of The Experiment: Introduction to MATLAB





Submitted By
Purab Ranjan Sutradhar
1106054
Section: A2
Partners ID: 1106055















Problem: Finding inverse of a square matrix
2 3 4
A= 5 6 7
8 9 1





Solution:

To determine the inverse of the given matrix A, following procedure has been adopted:

1. The adjunct of the given matrix ( i.e. the elements of its transpose replaced by their own co-
factors) is determined.

2. The determinant for the given matrix is determined.

3. Using A
-1
= adj (A)/ |A|, the inverse was found.














The MATLAB program for finding A
-1
is given below:


clc;
clear all;

M=[2 1 3;0 2 1;0 0 2];

for i=1:3
for j=1:3
if(i==3)

p=rem(i+2,3);
q=rem(i+1,3);

elseif(i==2)

p=rem(i+2,3);
q=i+1;

else p=i+2;
q=i+1;
end

if(j==3)
r=rem(j+2,3);
s=rem(j+1,3);
elseif(j==2)
r=rem(j+2,3);
s=j+1;

else r=j+2;
s=j+1;
end

B(i,j)=M(q,s)*M(p,r)-M(q,r)*M(p,s);

end
end

a=det(M);
X=B';
Y=X/a;
disp(Y);




_____ _____ _____ _____ _____




Result:

A
-1
= 0.5 -0.25 -0.62
0 0.50 -0.25
0 0 0.50



Discussion:
Although there are built-in functions inside MATLAB for detemination of inverse of a matrix, this method of
solving the problem manually using mathematical operations and loop operations gives a better understanding of the
trivial method for finding inverse for a matrix.

You might also like