ECEA106L EXP2 Solving A System of Linear Equations PDF
ECEA106L EXP2 Solving A System of Linear Equations PDF
A system of equations is a set or collection of equations that you deal with all
together at once; hence, a system of linear equations is when we have two or more linear
equations working together. In order to solve the system simultaneously, one of the first
thing we need to do is to convert the equations into coefficient and constant matrix in
order to perform matrix operations. Matrix, a set of numbers arranged in rows and
columns so as to form a rectangular array. The numbers are called the elements, or
entries, of the matrix. For this laboratory experiment, we solved a system of linear
equations using the direct and iterative methods using MATLAB.
For the first part of the experiment, a system of linear equations was solved using
several direct methods. For conventional direct method, Cramer’s rule was utilized which
is a method that uses determinants to solve systems of equations and the the values for
v, x, y and z are calculated as follows. Notice that x is obtained by taking the determinant
of the x-matrix divided by the determinant of the coefficient matrix. This rule holds for the
rest. Another technique used is the LU decomposition, in which factors a matrix as the
product of a lower triangular matrix and an upper triangular matrix can be viewed as the
matrix form of Gaussian elimination where a matrix A is written as a product of a lower
triangular matrix L and an upper triangular matrix U. MATLAB has a built-in function lu()
to solve a system of equation via LU decomposition, and backslash (\) or mldivide() to
solve linear equations directly. Regardless of methods used, the obtained values for v, x,
y, and z, are -0.9709, 4.3207, 5.8040, and 5.9113, respectively.
For the second part of the experiment, a system of linear equations was solved
using two iterative methods, specifically the Jacobi and Gauss-Seidel method. For both
iterative methods, a for loop command structure was utilized instead of repeatedly
entering commands for efficiency and convenience of answering this laboratory problem.
For Jacobi method, it uses the values obtained from the previous iteration and remains
unchanged until the entire nth iteration has been calculated. On the other hand, Gauss–
Seidel method always applies the latest updated values during the iterative procedures,
as demonstrated in the equations set up in MATLAB command window. Both halts in
iteration if the set tolerance is met. The obtained values for v, x, y, and z, again, are -
0.9709, 4.3207, 5.8040, and 5.9113, respectively, which is also the same values as with
the previous direct methods. Comparing results obtained from the Jacobi and Gauss–
Seidel methods from the laboratory exercise, the values of the variables are the same for
both, but we observed that the convergence occurs much quicker for the Gauss–Seidel
method, having lesser number of iterations than the Jacobi method. Therefore, the
Gauss–Seidel method is an improved form of Jacobi method.
In terms of computations, the direct method requires more in-core computer
memory, but the solutions are accurate. On the other hand, the indirect method reaches
the final solution gradually. However, as the level of convergence can be set by the users,
a lower precision may be desired in order to detect the potential trend of the changing
design variables much quicker than the direct method can provide.
CONCLUSION
According to the objectives of this experiment, we were able to understand
operations involving matrices and applied those matrix operations on the different
techniques in solving systems of linear equations through the MATLAB software. We had
also demonstrated, through the laboratory exercise, the two methods of solving systems
of linear equations, specifically: the direct method which involves both the conventional
and matrix LU decomposition methods, and the iterative methods such as Jacobi and
Gauss-Seidel Method. Iterative methods are an alternative to direct methods that attempt
to calculate an exact solution to the system of equations by repeatedly solving the linear
system until the answer converges, but this technique allows the user to set the desired
precision and tolerance of the value. The objectives were met; therefore, the experiment
was a success.
REFERENCES
Yang, K. H. (2018). Stepping Through Finite Element Analysis. In Basic Finite Element
Method as Applied to Injury Biomechanics (pp. 281-308). Academic Press.
University of Waterloo. (n.d.). The Jacobi Method. In Numerical Analysis for Engineering.
Retrieved from
https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/04LinearAlgebra/jacobi/
University of Waterloo. (n.d.). The Gauss-Seidel Method. In Numerical Analysis for
Engineering. Retrieved from
https://ece.uwaterloo.ca/~dwharder/NumericalAnalysis/ 04LinearAlgebra/gauss/
MAPÚA UNIVERSITY
EECE Department
Experiment 2
SOLVING SYSTEMS OF
LINEAR EQUATIONS