Test Code for LU Factorization
This is test code to show how to use the LU Factorization function and also to show how a script program will publish.
Contents
Set Up the Matrice to Factor
A=[2,-4,-2,3;6,-9,-5,8;2,-7,-3,9;4,-2,-2,-1;-6,3,3,4] B=[2,-1,2;-6,0,-2;8,-1,5]
A =
2 -4 -2 3
6 -9 -5 8
2 -7 -3 9
4 -2 -2 -1
-6 3 3 4
B =
2 -1 2
-6 0 -2
8 -1 5
Factor the matrices
[LA,UA]=LUfactorization(A) [LB,UB]=LUfactorization(B)
LA =
1 0 0 0
3 1 0 0
1 -1 1 0
2 2 0 1
-3 -3 0 -2
UA =
2 -4 -2 3
0 3 1 -1
0 0 0 5
0 0 0 -5
LB =
1 0 0
-3 1 0
4 -1 1
UB =
2 -1 2
0 -3 4
0 0 1