You are on page 1of 15

CI TE

2.0
U nle a shing Possibilit ie s

Electronics Engineering Department


Numerical Methods

Experiment #5: Solving Roots of Linear Equations using Direct Methods

I. OBJECTIVES
1. To be able to create .m file to solve Linear Equations using Gauss elimination and
LU Decomposition
2. To execute m file and get the correct value of the unknowns at the command
window

II. DISCUSSION
A system of linear equations can also be solved by using an iterative approach.
The process is same as in the fixed-point iteration method used for solving nonlinear
equation. In an iterative process for solving a system of equations, the equations are
written in an explicit form in which each unknown is written in terms of the other
unknown.

The solution process starts by assuming initial values for the unknowns (first
estimated solution). In the 1st iteration, the first assumed solution is substituted on the
right-hand side of the equations, and the new values that are calculated for the
unknowns are the 2nd estimated solution. In the 2nd iteration, the second solution is
substituted back in the equations to give new values for the unknowns, which are the
3rd estimated solution. The solutions that are obtained as successive iterations
converge toward the actual solution.

The iterations can be stopped when the absolute value of the estimated relative
error of all the unknowns is smaller than some predetermined value or the absolute
value of approximate error εa must be less than the acceptance error εs.

III. SOFTWARE NEEDED


ITEM NO. DESCRIPTION QUANTITY
MATLAB 1

IV. METHODOLOGY
CI TE

2.0
U nle a shing Possibilit ie s

Problem 1: Write a MATLAB program to solve a system of n linear equations and n


unknowns using:
a. The Gauss Elimination Method
b. LU Decomposition Method
Input data to the program should be
a. The number of equations
b. The augmented matrix
c. The starting vector
Output should consist of:
a. The augmented matrix
b. The vector solution
Problem 2: Test your program to solve the system:
a. Solve for i1, i2, i3, & i4 using LU DECOMPOSITION with Gauss Elimination
CI TE

2.0
U nle a shing Possibilit ie s

b. Solve the unknowns:


x – y + 2z – w = -1
2x + y – 2z – 2w = -2
-x + 2y – 4z+ w = 1
3x -3w = -3

V. OUTPUT
Problem 1
CI TE

2.0
U nle a shing Possibilit ie s

1. Editor Window
CI TE

2.0
U nle a shing Possibilit ie s

2. Command Window
CI TE

2.0
U nle a shing Possibilit ie s

Problem 2
(a)
1. Editor Window
CI TE

2.0
U nle a shing Possibilit ie s

2. Command Window
CI TE

2.0
U nle a shing Possibilit ie s
CI TE

2.0
U nle a shing Possibilit ie s
CI TE

2.0
U nle a shing Possibilit ie s

(b)
1. Editor Window

2. Command Window
CI TE

2.0
U nle a shing Possibilit ie s
CI TE

2.0
U nle a shing Possibilit ie s
CI TE

2.0
U nle a shing Possibilit ie s
CI TE

2.0
U nle a shing Possibilit ie s

VI. QUESTIONS

1. Using the created program, differentiate the methods used under Direct Method
of solving Linear Equations?

The methods used under Direct Method of Solving Linear Equations are the
Gauss Elimination and the LU Decomposition Method. The Gauss
Elimination Method utilizes a sequence of operations performed on the
corresponding matrix of coefficients. This method can also be used to find
the rank of a matrix, to calculate the determinant of a matrix, and to calculate
the inverse of an invertible square matrix.

LU Decomposition Method, on the other hand, is defined as the matrix form


of Gaussian elimination. It is the factorization of a given square matrix into
two triangular matrices, one upper triangular matrix and one lower triangular
matrix, such that the product of these two matrices gives the original matrix.

2. Which is more efficient? Why?

LU Decomposition is a much more efficient method of solving Linear


Equations because it focuses on the matrix of the coefficients used. Also, it
is much more efficient when solving for an equation which provides more
coefficients compared to Gauss Elimination Method. Hence, it is a more
straightforward approach to solving for Linear Equations as opposed to the
Gauss Elimination method.

VII. CONCLUSIONS:
Upon conducting the experiment, we were able to implement both LU Decomposition
and Gauss Elimination Method; which yielded different results. An iterative approach
was used by writing the equations in an explicit form. Upon doing so, the group
evaluated the correct values of the unknowns and computed the approximate error
which determined that LU Decomposition method is a more efficient method of solving
Linear Equations. Hence, the group can conclude that the objectives of the experiment
were met. The group was able to create a .m file which can solve Linear Equations
using Gauss elimination and LU Decomposition. The group was also able to execute
the said .m file and got the correct value of the unknowns at the command window.
Lastly, the group was able to compute the approximate error using Gauss elimination
and LU Decomposition and compare which method is more efficient.
CI TE

2.0
U nle a shing Possibilit ie s

You might also like