function x=gauss(A,b)
%x=gauss(A,b)
n=length(A);
a=[A,b];
for k=1:n-1
if a(k,k)==0
return;
end
m=0;
for i=k+1:n
m(i,k)=a(i,k)/a(k,k);
a(i,(k+1):(n+1))=a(i,(k+1):n+1)-m(i,k).*a(k,(k+1):(n+1));
end
end
%回代
if a(n,n)==0
return
end
x(n)=a(n,n+1)/a(n,n);
for i=n-1:-1:1
x(i)=(a(i,n+1)-sum(a(i,(i+1):n).*x((i+1):n)))/a(i,i);
end