function [x]=gauss_meth(A,b)
[m,n]=size(A);
A=[A,b];
for k=1:n-1
   for i=k:n
      A(i,k)=A(i,k)/A(k,k);
      A(i,k+1:n+1)=A(i,k+1:n+1)-A(i,k)*A(k,k+1:n+1);
   end;
end;

for j = n:-1:2,
   A(j,n+1)=A(j,n+1)/A(j,j); 
   A(1:j-1,n+1)=A(1:j-1,n+1)-A(j,n+1)*A(1:j-1,j);
end; 
A(1,n+1) = A(1,n+1)/A(1,1);

x=A(:,n+1);