Вы находитесь на странице: 1из 21

Numerical Methods Applied to Mechatronics

Dr. Jorge A. Olórtegui Yume, Ph.D.

LU FACTORIZATION

Lecture No 9

Mechatronics Engineering School


Nacional University of Trujillo
LU FACTORIZATION
Recall: In Gauss elimination method the forward-elimination
step of comprises the bulk of the computational effort.
Example: For the system
 a11 a12 a13   x1   b1 
a a23   x2   b2 
 21 a22
a31 a32 a33   x3  b3 

Ax  b
PROBLEM:
b modified in the process
 for a different b
process needs to be repeated
LU Factorization 2 Dr. Jorge A. Olortegui Yume, Ph.D.
LU FACTORIZATION
To avoid the PROBLEM let´s do some matrix manipulation
Ax  b  Ax b  0
can modify
this eqn. to
give: u11 u12 u13   x1   d1 
U :
U x  d 0 u
where: 
 0
22 u   x   d 
23   2   2
0 u33   x3   d 3  Upper triangular
Assume an lower
triangular matrix
exists such that
LU x d   Ax b
where:
1 0 0
L : L  l21 1 0
Lower triangular l31 l32 1
LU Factorization 3 Dr. Jorge A. Olortegui Yume, Ph.D.
LU FACTORIZATION
Then: LU x d   Ax b
LU   A
LU x Ld  Ax b Ld   b
In explicit form
 1 0 0 u11 u12 u13   x1   1 0 0  d1   a11 a12 a13   x1   b1 
l 1 0  0 u u   x   l 1 0  d   a a23   x2   b2 
 21  22 23   
2 21   2   21 a22
l31 l32 1  0 0 u33   x3  l31 l32 1  d 3  a31 a32 a33   x3  b3 
 1 0 0 u11 u12 u13   a11 a12 a13 
l 1 0  0 u u   a a23 
 21  22 23   21 a22
l31 l32 1  0 0 u33  a31 a32 a33 

1 0 0  d1   b1 
l 0 d 2   b2 
 21 1
l31 l32 1  d 3  b3 

LU Factorization 4 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
• LU factorization methods separate the time-
consuming elimination of the matrix [A] from the
manipulations of the right-hand-side [b].
• Once [A] has been factored (or decomposed),
multiple right-hand-side vectors [b] can be
evaluated in an efficient manner.
LU   A
Ld   b
U x  d
LU Factorization 5 Dr. Jorge A. Olortegui Yume, Ph.D.
LU FACTORIZATION
• LU factorization involves 2 steps:
– Decompose [A] matrix into a
product of [L] and [U].

LU   A
– Substitution to solve for {x}
– Forward (“Find d”)

Ld   b
– Backward (“Find x”)

U x  d
• Gauss elimination can be implemented using LU factorization
LU Factorization 6 Dr. Jorge A. Olortegui Yume, Ph.D.
LU FACTORIZATION
Using MATLAB
• To solve [A]{x}={b}, first decompose [A] to get
[L][U]{x}={b}
• Set up and solve [L]{d}={b}, where {d} can be found
using forward substitution.
• Set up and solve [U]{x}={d}, where {x} can be found
using backward substitution.
• In MATLAB:
[L, U] = lu(A)
d = L\b
x = U\d

LU Factorization 7 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
Example: Solve the following system using LU
decomposition in MATLAB.

LU Factorization 8 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
Example:

LU Factorization 9 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
Cholesky Factorization
• One of the most popular techniques to solve symmetric
systems.

• Based on [A]= [U]T[U]

• The rest of the process is similar to LU decomposition


and Gauss elimination, except only one matrix, [U],
needs to be stored.

LU Factorization 10 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
Cholesky Factorization
Homework: Write a general purpose Matlab program for
Chloesky factorzation methdod

LU Factorization 11 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
LU FACTORIZATION
Example:

LU Factorization 12 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
Using MATLAB

• MATLAB can perform a Cholesky factorization with the


built-in chol command:

U = chol(A)

LU Factorization 13 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
MATLAB left division operator (“\”)
• It examines the system to see which method will most
efficiently solve the problem.

• Includes trying:
• banded solvers
• back and forward substitutions
• Cholesky factorization for symmetric systems.
• If these do not work and the system is square, Gauss
elimination with partial pivoting is used.

LU Factorization 14 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
THE EIGENVALUE PROBLEM

LU Factorization 15 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
THE EIGENVALUE PROBLEM

LU Factorization 16 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
Example: A box weighing 13 Mg
contains a piece of equipment
and is held by three cranes
whose cables are connected at
ring D as shown. Determine the
tensions in cables DA, DB, DC

1.- By hand
2.- Numerically
(Note: Solve with LU
factorization using Gauss Partial
pivoting and verify with “lu”
and “/”)

LU Factorization 17 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
Solución

LU Factorization 18 Dr. Jorge A. Olortegui Yume, Ph.D.


LU FACTORIZATION
Example: Perform the analysis of the vibrational properties for the
free, undamped 3 degree of freedom system. That is:
1.- determine the equations of motion, natural frequencies,
normal mode shapes and response by hand
2.- Write a matlab program to calculate the natural frequencies
3.- Write a matlab program to calculate the mode shapes
4.- Verify using “eig” matlab function

m= 1 kg
k= 100 N/m
LU Factorization 19 Dr. Jorge A. Olortegui Yume, Ph.D.
LU FACTORIZATION
Example: Determine the current in each branch of the circuit shown

For the data in the next slide


LU Factorization 20 Dr. Jorge A. Olortegui Yume, Ph.D.
Solution: LU FACTORIZATION
k Ek rk Rk
(Index) (Volts) ( ) ( )

1 12 0.1 25
2 10 0.5 40
3 - - 16
4 12 0.5 20
5 24 0.2 9
6 - - 4
7 - - 20

LU Factorization 21 Dr. Jorge A. Olortegui Yume, Ph.D.

Вам также может понравиться