% Script diagdom.m % diagonally dominant matrices: examples format short A = [3 1 1; 1 3 1; 1 1 3] [L,U,P] = lu(A) % P is eye(3), the identity matrix; no row switch % B = [4 2 1 0; 1 4 1 1; 1 0 5 3; 0 0 4 6] [L,U,P] = lu(B) % P is eye(4) % add your own example % try a case when the sum of the nondiagonal % elements in each row equals the absolute value of the diagonal term D = [ 4 2 1 1; 2 4 1 1; 1 2 4 1; 1 1 2 4] [L,U,P] = lu(D)