lu factorization
DESCRIPTION
Num Methods 2TRANSCRIPT
Numerical Methods Applied to MechatronicsDr. Jorge A. Olórtegui Yume, Ph.D.
Lecture No 9
Mechatronics Engineering SchoolNacional University of Trujillo
LU FACTORIZATION
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.2
LU FACTORIZATIONRecall: In Gauss elimination method the forward‐elimination step of comprises the bulk of the computational effort.
3
2
1
3
2
1
333231
232221
131211
bbb
xxx
aaaaaaaaa
bxA
Example: For the system
PROBLEM:
repeated be toneeds process
different afor process in the modified
bb
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.3
LU FACTORIZATIONTo avoid the PROBLEM let´s do some matrix manipulation
3
2
1
3
2
1
33
2322
131211
000
ddd
xxx
uuuuuu
0 bxAbxAcan modify this eqn. to give:
dxU where: triangularUpper
:U
Assume an lowertriangular matrix exists such that bxAdxUL
101001
3231
21
lllL
where:
triangularLower
:L
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.4
LU FACTORIZATION
bxAdLxUL
Then: bdL
AUL
3
2
1
3
2
1
333231
232221
131211
3
2
1
3231
21
3
2
1
33
2322
131211
3231
21
101001
000
101001
bbb
xxx
aaaaaaaaa
ddd
lll
xxx
uuuuuu
lll
bxAdxUL
3
2
1
3
2
1
3231
21
101001
bbb
ddd
lll
333231
232221
131211
33
2322
131211
3231
21
000
101001
aaaaaaaaa
uuuuuu
lll
In explicit form
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.5
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.
bdL
AUL
dxU
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.6
LU FACTORIZATION• LU factorization involves 2 steps:
– Decompose [A] matrix into a product of [L] and [U].
– Substitution to solve for {x}– Forward (“Find d”)
– Backward (“Find x”)
• Gauss elimination can be implemented using LU factorization
AUL
bdL
dxU
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.7
LU FACTORIZATION
• 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\bx = U\d
Using MATLAB
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.8
LU FACTORIZATIONExample: Solve the following system using LU decomposition in MATLAB.
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.9
LU FACTORIZATIONExample:
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.10
LU FACTORIZATIONCholesky 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 Dr. Jorge A. Olortegui Yume, Ph.D.11
LU FACTORIZATIONCholesky FactorizationHomework: Write a general purpose Matlab program forChloesky factorzation methdod
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.12
LU FACTORIZATIONExample:
LU FACTORIZATION
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.13
LU FACTORIZATION
• MATLAB can perform a Cholesky factorization with the built‐in chol command:
U = chol(A)
Using MATLAB
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.14
LU FACTORIZATION
• 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.
MATLAB left division operator (“\”)
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.15
LU FACTORIZATIONTHE EIGENVALUE PROBLEM
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.16
LU FACTORIZATIONTHE EIGENVALUE PROBLEM
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.17
LU FACTORIZATIONExample: A box weighing 13 Mg contains a piece of equipmentand is held by three cranes whose cables are connected at ring D as shown. Determine thetensions in cables DA, DB, DC
1.‐ By hand2.‐ Numerically(Note: Solve with LU factorization using Gauss Partialpivoting and verify with “lu” and “/”)
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.18
LU FACTORIZATIONSolución
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.19
LU FACTORIZATIONExample: Perform the analysis of the vibrational properties for thefree, undamped 3 degree of freedom system. That is:1.‐ determine the equations of motion, natural frequencies, normal mode shapes and response by hand2.‐Write a matlab program to calculate the natural frequencies3.‐Write a matlab program to calculate the mode shapes4.‐ Verify using “eig” matlab function
m= 1 kgk= 100 N/m
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.20
LU FACTORIZATIONExample: Determine the current in each branch of the circuit shown
For the data in the next slide
LU Factorization Dr. Jorge A. Olortegui Yume, Ph.D.21
LU FACTORIZATIONSolution:
k(Index)
Ek(Volts)
rk()
Rk()
1 12 0.1 252 10 0.5 403 ‐ ‐ 164 12 0.5 205 24 0.2 96 ‐ ‐ 47 ‐ ‐ 20