A = [ 1 -1 0 0; -1 2 -1 0; 0 -1 2 -1; 0 0 -1 2]; if all(eig(A) > 0) C = Alg10(A) C*C.' - A inv(C) end C = 1 0 0 0 -1 1 0 0 0 -1 1 0 0 0 -1 1 ans = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ans = 1 0 0 0 1 1 0 0 1 1 1 0 1 1 1 1