You are on page 1of 2

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
Mtodo de Gauss-Jordan
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Jlio Csar Magalhaes de Freitas
0609535-6 %
% Luana Mara Lacerda
100950024 %
% Viviane Manuela Vale
112200084 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear all
close all
a1=matriz_100;
f=input('Entre com o nmero de linhas da matriz 100: ');
c=input('Entre com o nmero de colunas da matriz 100: ');
tic
for k=1:c-1
a1(k,:)=a1(k,:)/a1(k,k);
for j=k+1:f
a1(j,:)=a1(j,:)-a1(k,:)*a1(j,k);
j=j+1;
end
k=k+1;
end
for k=f:-1:2
for j=k-1:-1:1
a1(j,:)=a1(j,:)-a1(k,:)*a1(j,k);
j=j-1;
end
k=k-1;
end
d=a1;
toc
disp('-----------------------------------------------------------------------------------------------------------------------')
disp('')
a2=matriz_200;
f=input('Entre com o nmero de linhas da matriz 200: ');
c=input('Entre com o nmero de colunas da matriz 200: ');
tic
for k=1:c-1
a2(k,:)=a2(k,:)/a2(k,k);
for j=k+1:f
a2(j,:)=a2(j,:)-a2(k,:)*a2(j,k);
j=j+1;
end
k=k+1;

end
for k=f:-1:2
for j=k-1:-1:1
a2(j,:)=a2(j,:)-a2(k,:)*a2(j,k);
j=j-1;
end
k=k-1;
end
d=a2;
toc
disp('----------------------------------------------------------------------------------------------------------------------')
disp('')
a3=matriz_300;
f=input('Entre com o nmero de linhas da matriz 300: ');
c=input('Entre com o nmero de colunas da matriz 300: ');
tic
for k=1:c-1
a3(k,:)=a3(k,:)/a3(k,k);
for j=k+1:f
a3(j,:)=a3(j,:)-a3(k,:)*a3(j,k);
j=j+1;
end
k=k+1;
end
for k=f:-1:2
for j=k-1:-1:1
a3(j,:)=a3(j,:)-a3(k,:)*a3(j,k);
j=j-1;
end
k=k-1;
end
d=a3;