[討論] Givens Rotation: a 3x3 matrix illust …
The following is the matlab code to transform
a 3x3 matrix to an upper triangualr one.
Please copy them into matlab command window line by line to see the result:
p1=0.9;
p2=p1*p1;
A=[1 p1 p2; p1 1 p1; p2 p1 1]
theta=(A(1,1)^2+A(2,1)^2)^(0.5);
theta=A(1,1)/theta;
theta=acos(theta);
B=[cos(theta) sin(theta) 0; -sin(theta) cos(theta) 0; 0 0 1];
A=B*A
theta=(A(1,1)^2+A(3,1)^2)^(0.5);
theta=A(1,1)/theta;
theta=acos(theta);
B=[cos(theta) 0 sin(theta); 0 1 0;-sin(theta) 0 cos(theta)];
A=B*A
theta=(A(2,2)^2+A(3,2)^2)^(0.5);
theta=A(2,2)/theta;
theta=acos(theta);
B=[1 0 0; 0 cos(theta) sin(theta);0 -sin(theta) cos(theta)];
A=B*A
Now you have an upper triangular matrix.
I hope this will help you to understand how Givens works.
aluba1.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.195.2.128
※ 編輯: aluba1 來自: 123.195.2.128 (05/21 05:27)
推
05/21 18:54, , 1F
05/21 18:54, 1F