home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / MATFUN.DI$ / PLANEROT.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  421 b   |  18 lines

  1. function [G,x] = planerot(x)
  2. %PLANEROT Generate a Givens plane rotation.
  3. %    [G,Y] = PLANEROT(X), where X is a 2-component column vector,
  4. %    returns a 2-by-2 orthogonal matrix G so that Y = G*X has Y(2) = 0.
  5. %
  6. %    See also QRINSERT, QRDELETE.
  7.  
  8. %    CBM 9/11/92.
  9. %    Copyright (c) 1984-93 by the MathWorks, Inc.
  10.  
  11. if x(2) ~= 0
  12.    r = norm(x);
  13.    G = [x(1) x(2); -x(2) x(1)]/r;
  14.    x = [r; 0];
  15. else
  16.    G = eye(2);
  17. end
  18.