function [ x ] = gauss( A, b )

[n,m] = size(A);
A = [A, b];

for k = 1:n-1
    for i = k+1:n
        s = -A(i,k)/A(k,k);
        for j = 1:m+1
            A(i,j) = A(i,j) + s * A(k,j);
        end
    end
end

x = zeros(n,1);
for k = n:-1:1
   s = 0;
   for i = k+1:n
       s = s + A(k,i)*x(i);
   end
   x(k) = (A(k,n+1)-s) / A(k,k);    
end

end

