
%Gaussian elimination

A = [1,1,0,3;2,1,-1,1;3,-1,-1,2;-1,2,3,-1];
b = [4;1;-3;4];

[n,m] = size(A);

if (m ~= n)
display('the number of columns and rows are not equal\n');
return;
end

A = [A,b];

for i = 1:n-1;

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

end

