You are on page 1of 8

Laboratory Activity No.

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

2. Intended Learning Outcomes (ILOs):

The students shall be able to:


2.1 Demonstrate scientific thinking and the ability to approach scientific resources intelligently.
2.2 Utilize MATLAB software in solving linear systems by Gaussian Elimination with back -substitution
and Gauss-Jordan Elimination.
2.3 Infer appropriate conclusions based upon the results of activity.
2.4 Reflect on personal transformation along the TIP graduate attributes, specifically, professional
competence and critical thinking skills.

3. Discussion:

     The procedure for using Gaussian elimination with back-substitution is summarized below.

1. Write the augmented matrix if the system of linear equations.


2. Use elementary row operations to rewrite the matrix in row-echelon form.
3. Write the system of linear equations corresponding to the matrix in row-echelon form, and use
back-substitution.

The procedure for using Gauss-Jordan Elimination summarized below.

1. Write the augmented matrix if the system of linear equations.


2. Use elementary row operations to rewrite the matrix in reduced row-echelon form.
3. Write the system of linear equations corresponding to the matrix in reduced row-echelon form.
0 7 2319 11

[ ]
18 14 1 5 22
6 2017 13 4
12 3 9 2115
24 16 10 2 8
4. Procedure:

GAUSSIAN ELIMINATION METHOD

EXAMPLE 1: Solve the linear system

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 Gaussian Elimination

1. Input the following codes to your MATLAB edit window

%Gauss elimination 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(j,:);a(j,:)=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
x=zeros(1,m);
for s=m:-1:1
c=0;
for k=2:m
c=c+a(s,k)*x(k);
end
x(s)=(a(s,n)-c)/a(s,s);
end
disp('Gauss elimination method:');
a
x'

2. Run the program then input the corresponding augmented matrix.

3. Write the output below

GAUSS-JORDAN ELIMINATION

EXAMPLE 2: Solve the linear system

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

1. Input the following codes to your MATLAB edit window

% 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. Run the program then input the corresponding augmented matrix.

3. Write the output below

1. What is the difference between Gaussian Elimination and Gauss-Jordan Elimination

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

Use MATLAB to solve the system of linear equations

1. 123.5 x+ 61.3 y −32.4 z=−262.74


54.7 x−45.6 y+ 98.2 z=197.4
42.4 x−89.3 y+ 12.9 z=33.66

2. 120.2 x +62.4 y−36.5 z=258.64


56.8 x−42.8 y +27.3 z=−71.44
88.1 x+72.5 y −28.5 z=225.88
3. x 1+ 0.5 x 2 +0.33 x 3+ 0.25 x 4 =1.1
0.5 x 1+ 0.33 x 2 +0.25 x 3+ 0.21 x 4 =1.2
0.33 x 1+ 0.25 x 2 +0.2 x3 +0.17 x 4 =1.3
0.25 x 1+ 0.2 x 2 +0.17 x 3+ 0.14 x 4=1.4

4. 0.1 x 1−2.5 x 2 +1.2 x3 −0.75 x 4=108


2.4 x 1 +1.5 x 2−1.8 x 3 +0.25 x 4=−81
0.4 x 1−3.2 x 2+1.6 x 3 +1.4 x 4 =148.8
1.6 x 1+1.2 x 2−3.2 x3 +0.6 x 4 =−143.2

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:

6. Assessment (Rubric for Activity Performance):

BEGINNER ACCEPTABLE PROFICIENT


CRITERIA SCORE
1 2 3
I. Activity Skills
Work that usually needs to have quality of work and Provides work of the
Quality of work be checked/redone by some small errors on the highest quality and answers
others to ensure quality answer are correct
Group is rarely focused on Group is focused on the Group is consistently stays
Focus on the
the task and what to be task and what needs to be focused on the task and
task
done done most of the time what needs to be done
Members do not Members occasionally Members always
Process Skills demonstrate targeted demonstrate targeted demonstrate targeted
process skills. process skills. process skills.
II. Work Habits
Time
Members finish ahead of
Management / Members do not finish on Members finish on time with
time with complete data
Conduct of time with incomplete data. incomplete data.
and time to revise data.
Experiment
Members are on tasks and
Members do not know their Members have defined
have defined
tasks and have no defined responsibilities most of the
Cooperative and responsibilities at all times.
responsibilities. Group time. Group conflicts are
Teamwork Group conflicts are
conflicts have to be settled cooperatively managed
cooperatively managed at
by the teacher. most of the time.
all times.
Clean and orderly Clean and orderly
Neatness and Messy workplace during workplace with occasional workplace at all times
Orderliness and after the experiment. mess during and after the during and after the
experiment. experiment.
Ability to do
Members require Members require occasional Members do not need to be
independent
supervision by the teacher. supervision by the teacher. supervised by the teacher.
work
Other Comments / Observations:
TOTAL SCORE

Rating =
(Total Score / 21)

You might also like