MATLAB: Solving Linear Equations with Doolittle LU Decomposition, Study Guides, Projects, Research of Mechanical Engineering

A computational project for students where they are required to develop, debug, and test a matlab m-file that solves a system of linear equations using doolittle lu decomposition. The project involves writing code that can handle arbitrary rectangular matrices and right-hand sides, as well as checking for rank-deficiency and displaying an error message if necessary. Students are encouraged to solve several example systems of linear equations and check their results.

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 02/13/2009

koofers-user-lh4
koofers-user-lh4 šŸ‡ŗšŸ‡ø

8 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Computational Project # 2
Due February 9
Develop, debug, and test a program (MATLAB m-file) that solves a system of linear
equations
=
Ax b
using Doolittle LU decomposition. (Important: do not perform Crout LU
decomposition, you will be given no credits for it.)
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 vector x and matrices L and U are your output arguments.
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 LU decomposition you will encounter
zero diagonal element. This can only happen if the rows or columns 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
0 1 1 4
1 3 2 4
1 2 1 8
x
x
x
 
āˆ’
   
 
   
=
 
   
 
   
āˆ’
   
 
b)
1
2
3
0 2 2 1
x
x
x
 
   
 
   
=
 
   
 
   
   
 
c)
1
2
3
4
2 2 1 3 1
2 1 1 3 3
1 1 1 4 0
3 3 4 1 9
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.

Partial preview of the text

Download MATLAB: Solving Linear Equations with Doolittle LU Decomposition and more Study Guides, Projects, Research Mechanical Engineering in PDF only on Docsity!

Computational Project # 2

Due February 9

Develop, debug, and test a program (MATLAB m-file) that solves a system of linear equations Ax = b

using Doolittle LU decomposition. ( Important : do not perform Crout LU decomposition, you will be given no credits for it.)

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 vector x and matrices L and U are your output arguments.

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 LU decomposition you will encounter zero diagonal element. This can only happen if the rows or columns 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.