0% found this document useful (0 votes)
18 views8 pages

EEE 2206 Lab Report 7 by Saklain

Lab report on EEE background students

Uploaded by

211129.eee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views8 pages

EEE 2206 Lab Report 7 by Saklain

Lab report on EEE background students

Uploaded by

211129.eee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Dept.

of
Electrical & Electronic Engineering
Lab. Report on

EEE 2206: NUMERICAL METHODS &


STATISTICS IN ENGINEERING SESSIONAL

Student Name: Saklain Mustak

Student ID: 211129

Experiment No: 07
Experiment Name: Experimental study on solution of linear system of
equations by Gaussian Elimination and Gauss-Jordan method using MATLAB

Date of Experiment: 03-11-2024


Date of Submission: 10-11-2024

Course Teacher: Md. Rabiul Islam,


Lecturer, EEE, JUST

Comments:

JASHORE UNIVERSITY OF SCIENCE & TECHNOLOGY


Jashore-7408, Bangladesh
Experiment No: 07

Experiment Name: Experimental study on solution of linear system of equations by Gaussian


Elimination and Gauss-Jordan method using MATLAB.

Objectives:

To understand the working principle of Gaussian Elimination and Gauss-Jordan methods


for solving systems of linear equations.
To implement Gaussian Elimination and Gauss-Jordan methods in MATLAB scripts code.
To compare the step-by-step computational processes involved in both Gaussian
Elimination and Gauss-Jordan methods

Theory:

Linear System of Equations: A system of linear equations consists of multiple linear equations
involving the same set of variables. Solving such systems is essential in various fields of
engineering, physics, and mathematics, where linear relationships model real-world phenomena.
Mathematically, a system of n linear equations with n variables can be represented as

퐴. 푋 =

Where:

A is a n×n matrix of coefficients’


X is a column vector of unknown variables,
B is a column vector of constants.

The Gaussian Elimination Method: The Gaussian Elimination method is a systematic procedure
used to transform a system of linear equations into an upper triangular form. This method uses
elementary row operations (row swapping, scaling, and addition/subtraction) to simplify the matrix
into a form where the solutions can be obtained through back-substitution.
1. Forward Elimination: The process begins by creating zeros below the main diagonal to
achieve an upper triangular matrix. This involves scaling rows and eliminating coefficients
in a step-by-step manner.
2. Back Substitution: After achieving the upper triangular form, we solve for each variable
starting from the last equation and moving upwards.

Gaussian Elimination is efficient for many systems, especially when speed is essential. However,
the method may suffer from numerical instability, especially for ill-conditioned matrices, where
small changes in input can lead to significant changes in output.

Gauss-Jordan Method: The Gauss-Jordan method is an extension of Gaussian Elimination that


goes a step further to achieve a reduced row echelon form (RREF). In RREF, the matrix has both
zeros below and above the main diagonal, converting it into a diagonal matrix. This method
eliminates the need for back-substitution, as each variable can be read directly from the diagonal
entries.

1. Forward Elimination and Row Reduction: Like Gaussian Elimination, Gauss-Jordan


starts with forward elimination but continues to make zeros both below and above each
leading 1 (pivot).
2. Normalization: Each leading entry (pivot) is made into 1 by dividing its row by the pivot
value.

While Gauss-Jordan Elimination provides a straightforward solution without requiring back-


substitution, it requires more computational steps than Gaussian Elimination, which can make it
less efficient for large matrices.

Algorithms:

The Gaussian Elimination Method:

1. Start
2. Input the coefficient matrix A and source vector B
3. Determine the length N of the vector B and initialize the solution vector X as a zero vector
of length N.
4. Create an augmented matrix Aug by appending B to A
5. Perform forward elimination to transform the matrix into an upper triangular form
Outer loop: for each row from 1 to N-1
Inner loop: For each row i from j+1 to N
Aug(i,j)
Calculate the multiplier m =
Aug(j,j)
Update the i-th row by subtracting m × j-th row from it
6. Display the augmented matrix Aug after forward elimination.
7. Perform the back substitution for each variable.
Aug(N,N+1)
Set the last element X as
Aug( N,N)
For each row k from N-1 to 1 calculate x(k) using the formula
Aug(k, N + 1) − ∑푁푙 =푘 +1(Aug(k, l) × X(l))
X(k) =
Aug(k, k)
8. Display the solution vector X.
9. End

Gauss-Jordan Method:

1. Start
2. Input the coefficient matrix A and the source vector B.
3. Determine the length N of B
4. Create an augmented matrix Aug by appending B as the last column of A.
5. Perform Gauss-Jordan Elimination to convert the matrix into reduced row echelon form
(RRFF)
For each row j from 1 to N
Normalize the j-th row by dividing it by the pivot element Aug(j,j)
For each i to N
If i≠j calculate the multiplier m= Aug(i,j)
Update the i-th row by subtracting m× the j-th row from it to make all other entries
in the j-th column zero
6. Display the augmented matrix Aug after Gauss-Jordan Elimination.
7. Extract the solution vector X from the last column of the augmented matrix Aug.
8. Display the solution vector X.
9. End

MATLAB script codes and output:

The Gaussian Elimination Method:

Script code:
Output:
Gauss-Jordan Method:

Script Code:

Output:
Discussion:
In this experiment, both Gaussian Elimination and Gauss-Jordan Elimination methods were used
to solve a system of linear equations in MATLAB, highlighting their approaches, efficiencies, and
practical applications.

Gaussian Elimination transforms the matrix into an upper triangular form, enabling solutions
through back-substitution. This method is computationally efficient, making it suitable for larger
systems. However, it requires an additional step of back-substitution to find the solution, which
can add complexity in manual calculations but is handled efficiently by MATLAB.

Gauss-Jordan Elimination, on the other hand, takes the process further by reducing the matrix to
reduced row echelon form (RREF), allowing direct extraction of the solution vector without back-
substitution. Although Gauss-Jordan Elimination provides a clearer path to unique solutions and
matrix inverses, it involves more operations, making it computationally heavier for large matrices.
Additionally, both methods may encounter numerical instability when pivot elements are close to
zero, which can lead to inaccuracies, especially in ill-conditioned matrices.

The MATLAB implementation of these methods effectively managed the row operations and
minimized potential errors. This experiment demonstrated MATLAB’s capability to perform
complex matrix transformations accurately, facilitating the practical use of Gaussian and Gauss-
Jordan methods for solving linear systems. Both methods proved useful, with Gaussian
Elimination offering efficiency and Gauss-Jordan providing a straightforward approach to unique
solutions, each suited to different applications depending on matrix size and computational needs.

References:

1. Numerical Analysis by Md. Hafizur Rahman.


2. https://www.mathworks.com/matlabcentral/answers/494692-how-to-solve-system-of-
equation-using-gaussian-elimination-or-gauss-JORDAN

You might also like