Write a program which can be used to solve any system of equation using the Scaled Pivoting GE method
The code for the problem is:
clc;clear all
format short
A=[0.003 12.34;0.4321 1];
B=[12.343;5.321];
ans1=Gauss(A,B)
function x=Gauss(A,B)
AB=[A,B];
[r c]=size(AB);
x=ones(r,1);
for(i=1:r-1)
for(j=i+1:r)
AB(j,i:c)=AB(j,i:c)-(AB(j,i)/AB(i,i))*AB(i,i:c);
end
end
x(r)=AB(r,c)/AB(r,r);
for(i=r-1:-1:1)
x(i)=(AB(i,c)-AB(i,c-1:-1:i+1)*x(c-1:-1:i+1,1))/AB(i,i);
end
end
Get Answers For Free
Most questions answered within 1 hours.