Professional Documents
Culture Documents
Laboratory Activity 3 - Gaussian and Gauss-Jordan
Laboratory Activity 3 - Gaussian and Gauss-Jordan
3
Gaussian and Gauss-Jordan Elimination
Name: Section:
Date Performed: Date Submitted:
Instructor:
1. Objective(s):
1.1 To solve linear systems by Gaussian Elimination with back -substitution using MATLAB
1.2 To solve linear systems by Gauss-Jordan Elimination using MATLAB
3. Discussion:
The procedure for using Gaussian elimination with back-substitution is summarized below.
[ ]
18 14 1 5 22
6 2017 13 4
12 3 9 2115
24 16 10 2 8
4. Procedure:
3 x+ 4 y −2 z +2 w=2
4 x+ 9 y−3 z+5 w=8
−2 x−3 y+ 7 z+6 w=10
x +4 y+ 6 z +7 w=2
GAUSS-JORDAN ELIMINATION
3 x+ 4 y −2 z +2 w=2
4 x+ 9 y−3 z+5 w=8
−2 x−3 y+ 7 z+6 w=10
x +4 y+ 6 z +7 w=2
using Gauss-Jordan
% Gauss-Jordan method
a = input('Enter the augmented matrix: ');
[m,n]=size(a);
for j=1:m-1
for z=2:m
if a(j,j)==0
t=a(1,:);a(1,:)=a(z,:);
a(z,:)=t;
end
end
for i=j+1:m
a(i,:)=a(i,:)-a(j,:)*(a(i,j)/a(j,j));
end
end
for j=m:-1:2
for i=j-1:-1:1
a(i,:)=a(i,:)-a(j,:)*(a(i,j)/a(j,j));
end
end
for s=1:m
a(s,:)=a(s,:)/a(s,s);
x(s)=a(s,n);
end
disp('Gauss-Jordan method:');
a
x'
2. What is the characteristic of the given linear system? How many solution/s? (Write the solutions)
ACTIVITY
Solve the linear system using both gaussian and gauss-jordan elimination
3 x 1−2 x 2 +4 x3 =1
x 1+ x2−2 x 3=3
2 x1 −3 x 2 +6 x 3=8
What is the characteristic of the given linear system? How many solution/s? (Write the solutions)
EXERCISES
1 1 1 1
5. x− y+ z− w=1
8 7 6 5
1 1 1 1
x + y− z + w=1
7 6 5 4
1 1 1 1
x− y + z− w=1
6 5 4 3
1 1 1 1
x + y− z + w=1
5 4 3 2
5. Conclusion:
Rating =
(Total Score / 21)