Description
Write a function myLU to perform the LU factorization for an arbitrary n×n matrix
(under the assumption that elimination can be performed without row exchanges).
Run the function on the input,
A =
1 2 7 1 8 2 8
3 7 22 11 26 14 28
2 5 16 15 27 12 24
8 22 66 77 117 66 107
3 15 35 101 93 85 86
8 18 65 62 151 64 130
6 16 49 62 133 96 173
.
Test to see if this factorization is correct.
HW GUIDELINES
• You should turn in both your completed code (the m-file), and the diary
file containing successful execution of the code (using the test given in the
problem). Make sure that the diary is a .txt file and do not compress the
file(s).
• Remember to only show output where appropriate.
• The m-file should be commented so that the reader can understand what
the program/function does.
• MATLAB has a built-in function for LU factorization. You may not use
any built-in LU factorization functions in your m-file.
• Your diary file should look like the following:
% Name Lastname
>> A = [1 2 7 1 8 2 8; 3 7 22 11 26 14 28; 2 5 16 15 27 12 24;
8 22 66 77 117 66 107; 3 15 35 101 93 85 86; 8 18 65 62 151 64
130; 6 16 49 62 133 96 173];
>> [L,U] = myLU(A)
L = [7×7 Lower Triangular Matrix Output of myLU(A)]
U = [7×7 Upper Triangular Matrix Output of myLU(A)]
>> A – L*U
ans = [7×7 Zeros Matrix]
diary off

