Page 248 - MATLAB an introduction with applications
P. 248
Numerical Methods ——— 233
Upper triangular form of given matrix is=
1.0000 1.0000 1.0000 –1.0000
0 –1.0000 –3.0000 5.0000
0 0 4.0000 –7.0000
0 0 0 0.2500
b =
2
3
–8
1
final solution is
–1
2
5
4
Check with MATLAB built-in function:
>> A = [1 1 1 –1;4 3 1 1;1 –1 –1 2;2 1 2 –2];
>> b = [2;11;0;2];
>> x = A\b
x =
–1.0000
2.0000
5.0000
4.0000
Example E4.14: Solve the following system of equations using Choleski’s factorization.
x + x + x – x = 2
2
4
3
1
x – x – x + 2x = 0
1
2
3
4
4x + 4x + x + x = 11
2
1
3
4
2x + x + 2x – 2x = 2
4
3
1
2
Solution:
Choleski’s factorization is basically applicable to only symmetric positive definite matrices.
Here original matrix [A] is decomposed as follows:
. T
1. Form [A] = L L where L is lower triangular matrix
2. Forward substitution to solve Ly = b for y
3. Back substitution to solve L x = y for x
T
For non-symmetric matrix a LU decomposition scheme can be employed using MATLAB function ‘lu(A)’.
Complete MATLAB program is given below to solve the problem.
A = [1 1 1 –1;1 –1 –1 2;4 4 1 1;2 1 2 –2];
b = [2;0;11;2];