planerot.m

来自「matpower软件下」· M 代码 · 共 21 行

M
21
字号
function [G,x] = planerot(x)
%PLANEROT Givens plane rotation.
%   [G,Y] = PLANEROT(X), where X is a 2-component column vector,
%   returns a 2-by-2 orthogonal matrix G so that Y = G*X has Y(2) = 0.
%
%   Class support for input X:
%      float: double, single
%
%   See also QRINSERT, QRDELETE.

%   Copyright 1984-2004 The MathWorks, Inc. 
%   $Revision: 5.10.4.1 $  $Date: 2004/04/10 23:30:05 $

if x(2) ~= 0
   r = norm(x);
   G = [x'; -x(2) x(1)]/r;
   x = [r; 0];
else
   G = eye(2,class(x));
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?