function x=gauss(a,b)
% Gauss elimination
n=length(b);	  
carpan=0;
toplam=0;
  %gauss eleme
  for k=1:n
    for i=k+1:n
      carpan=a(i,k)/a(k,k);
       a(i,k)=0;
       for j=k+1:n
          a(i,j)=a(i,j)-carpan*a(k,j); 
       end
           b(i)   =b(i)   -carpan*b(k);
    end
  end
  %back substituting
  x(n)=b(n)/a(n,n);
  for i=n-1:-1:1
    toplam=0;
    for j=i+1:n
      toplam=toplam+a(i,j)*x(j);end
    x(i)=(b(i)-toplam)/a(i,i);
  end
end