Beruflich Dokumente
Kultur Dokumente
clc;
n= input('Enter the order of matrix : ');
for a=1:n
for b=1:n
yo(a,b)=input('Enter the elements of the matrix');
end
end
a=inv(yo);
disp('Actual Inverse');
disp(a);
for k=1:n
t=yo(k,k);
yn(k,k)=-1/yo(k,k);
for i=1:n
for j=1:n
if(i==k&&j~=k || i~=k&&j==k)
yn(i,j)=yo(i,j)/t;
elseif(i~=k&&j~=k)
yn(i,j)=yo(i,j) - ( (yo(i,k)*yo(k,j)) /t );
end
end
end
yo=yn;
end
x=-yo;
disp('Inverse By Pivotal Method');
disp(x);