Professional Documents
Culture Documents
MATLAB Source Code: 'Please Enter Matrix:'
MATLAB Source Code: 'Please Enter Matrix:'
MATLAB Source Code: 'Please Enter Matrix:'
j=j+1;
end
end
b=di(:,z);
d(i)=(b(i)-c)/L(i,i);
i=i+1;
c=0;
j=1;
end
%solve Ux=d using backward substitution
i=n;
j=n;
while i>0
while j>0
if j~=i
y=a(i,j)*x(j)+y;
j=j-1;
else
j=j-1;
end
end
x(i)=(d(i)-y)/U(i,i);
xi(i,z)=x(i);
i=i-1;
j=n;
y=0;
end
z=z+1;
i=i+1;
end
display(xi) %display inverse of matrix a
end
Flow chart
Start
Input Matrix, a
If square matrix
m=n
m=no. of row
n= no. of column
Output
No Inverse of Matrix a
TRUE
for j=1:n
FALSE
for j = 1:n-1
j = column of matrix
To get L matrix
L(j,j)= 1
for i = j+1:n
i = row of matrix
for i=1:n-1
f= U(i,j)/U(j,j)
f = factor
U= U matrix of LU
for j=i+1:n
Get U matrix of LU
U(i,j:n)=U(i,j:n)-f*U(j,j:n)
To get L matrix
L(j,j)= 1
Do LU decomposition method
to find inverse of matrix a by
using forward substitution and
backward substitution
Get L matrix of LU
L(i,j:n)=f
Output
Determinant of Matrix a
End