Professional Documents
Culture Documents
AIM
Gauss Elimination involves combining equations to eliminate
unknowns. Although it is one of the earliest methods for solving
simultaneous equations. it remains among the most important
algorithms in use now a days and is the basis for linear equation
solving on many popular software packages.
THEORY
In the method of Gauss Elimination, the fundamental idea is to add
multiples of one equation to the others in order to eliminate a
variable and to continue this process until only one variable is left.
Once this final variable is determined, its value is substituted back
into the other equations in order to evaluate the remaining
unknowns. This method characterized by step-by step elimination of
the variables.
Flowchart
Equations
9x1+3x2+x3=9.31
4x1+2x2+x3=8
16x1+4x2+x3=13
Mat lab code of gauss elimination
Input code
clc
A=[9 3 1;4 2 1;16 4 1];
b=[9.31;8;13];
[n,~]=size(A);
x=zeros(n-1);
for i=1:(n-1)
m=A(i+1:n,i)/A(i,i);
A(i+1:n,:)=A(i+1:n,:)-m*A(i,:);
b(i+1:n,:)=b(i+1:n,:)-m*b(i,:);
end
x(n,:)=b(n,:)/A(n,n);
for i=n-1:-1:1
x(i,:)=(b(i,:)-A(i,i+1:n)*x(i+1:n,:))/A(i,i);
end
x;
out put
x =
1.1900 1.1900
-4.6400 -4.6400
12.5200 12.5200
1.1900 1.1900
-4.6400 -4.6400
12.5200 12.5200