
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Develop, debug, and test a program (preferably MATLAB m-file) that solves a system of
linear equations
Ax = b
using Gauss-Jordan elimination with partial pivoting. In the process of Gauss-Jordan
elimination your code should automatically perform partial pivoting, i.e. check whether
the diagonal element is zero or not. If it is zero, replace this row with the first row below
for which the element is not zero. Do not forget to put the original row into the place of
the row that you used to replace the one with the zero element. The code should be able
to solve for arbitrary rectangular n Ć n matrix A and right hand-side b. Organize your
code such a way that both matrix A and vector b are the input parameters and x is your
output vector.
Consider the possibility that matrix A is rank-deficient and the system does not have the
solution. This will happen when in the process of partial pivoting you will face the
situation that all the rows below have the first element zero. This can only happen if the
rows are linear dependent. If this happen, make your program display the error message
like āerror: matrix is rank deficientā and stop.
If possible, solve the following systems of linear equations with your own program:
a)
1
2
3
x
x
x
b)
1
2
3
x
x
x
c)
1
2
3
4
x
x
x
x
Check you results by substituting x into Ax and compare it with b. If your code is correct,
Ax should be identical to b. If your code can not solve the problem, see whether you can
invert the matrix using MATLAB internal procedure, inv(A). If you can, then the
problem definitely has the solution and something is wrong with your code.
P.S. Email your code. The program that you send should be a working program All the
codes will be checked whether they run or not.. If they are erroneous, but run, points will
be taken for the errors. If the code is not running (it has some syntax errors), an
additional 25% will be taken out. The goal of this class is for you to be comfortable
solving engineering problems. Please take your time and learn how to trust the computer.