Guest User

Untitled

a guest
Sep 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. Given matrix A.
  2.  
  3. [L,U,P] = lu(A); % calculate partial-pivoted LU decomposition of A
  4.  
  5. D = diag(diag(U)); % get diagonal matrix
  6.  
  7. U = DU; % the 'U' that is needed is really inv(D)*U
  8.  
  9. A = [1 2 3 ; 4 5 6 ; 7 8 9] ;
  10. [L U P] = lu(A) ; % calculate p-p LU decomp.
  11.  
  12. D = diag(diag(L)) ; % get diagonal matrix
  13.  
  14. L * D * U % check left side
  15. P * A % check right
Add Comment
Please, Sign In to add comment