Guest User

Untitled

a guest
Dec 11th, 2019
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. A=[1 2 1
  2. 2 2 3
  3. 1 3 6];
  4. %A = [3 -2 1 4; -2 -6 2 -1; 1 2 -2 5; 4 -1 5 -7];
  5.  
  6. W = diag([1 1 1 ]);
  7. for i = 1:11
  8. Q = diag([1 1 1]);
  9. [p,q] = maxmat(tril(A,-1)+triu(A,1))
  10. eta = (A(q,q)-A(p,p))/(2*A(p,q))
  11. t = sign(eta)/(abs(eta)+sqrt(eta^2+1))
  12. c = 1/sqrt(t^2+1)
  13. s = t*c
  14. Q(p,p) = c;
  15. Q(q,q) = c;
  16. Q(p,q) = s;
  17. Q(q,p) = -s;
  18. disp(Q)
  19. A = Q'*A*Q
  20. W = W*Q
  21. end
  22.  
  23. %x3 = W(:,3)./W(3,3);
RAW Paste Data