How to use the lu decomposition to make matrix become invers
How to use the lu decomposition to make matrix become inverse matrix in Matlab. plz show the code
Solution
>> A=[1 2 -1;4 3 0;1 -1 3];
>> [L,U,P]=lu(A);
>> B=inv(U)*inv(L);
Where B is the inverse of A
OUTPUT
>> A=[1 2 -1;4 3 0;1 -1 3]
A =
1 2 -1
 4 3 0
 1 -1 3
>> [L,U,P]=lu(A)
L =
1.0000 0 0
 0.2500 1.0000 0
 0.2500 -0.7143 1.0000
 U =
4.0000 3.0000 0
 0 -1.7500 3.0000
 0 0 1.1429
 P =
0 1 0
 0 0 1
 1 0 0
>> B=inv(U)*inv(L)
B =
0.6250 -0.3750 -1.1250
 -0.5000 0.5000 1.5000
 -0.3750 0.6250 0.8750
![How to use the lu decomposition to make matrix become inverse matrix in Matlab. plz show the codeSolution>> A=[1 2 -1;4 3 0;1 -1 3]; >> [L,U,P]=lu(A How to use the lu decomposition to make matrix become inverse matrix in Matlab. plz show the codeSolution>> A=[1 2 -1;4 3 0;1 -1 3]; >> [L,U,P]=lu(A](/WebImages/27/how-to-use-the-lu-decomposition-to-make-matrix-become-invers-1070765-1761560848-0.webp)
