In: Electrical Engineering
10? + 50? + 20? + 10? = 100
5? + 15? + 75? − 25? = 200
25a − 15? − 5? = 300
10? + 20? − 30? + 100? = 400
how to write coding in matlab using lu decomposition
>> A=[10 50 20 10;5 15 75 -25;25 0 -15 -5;10 20 -30 100]
A =
10 50
20 10
5 15
75 -25
25 0
-15 -5
10 20
-30 100
>> [L,U]=lu(A)
L =
0.4000
1.0000
0 0
0.2000
0.3000
1.0000 0
1.0000
0
0 0
0.4000 0.4000
-0.4900 1.0000
U =
25.0000 0
-15.0000 -5.0000
0
50.0000 26.0000 12.0000
0 0
70.2000 -27.6000
0
0 0
83.6752
Thus, the code decomposes matrix A into lower triangular matrix (L) and upper triangular matrix (U).