lose all;home;clc;clear all;
for i=1:1:7
for j =1:1:7
M0(j,i)=i+7*(j-1);
end
end
for i=2:1:7
for j =1:1:i-1
M0(i,j)=M0(j,i);
end
end
for i=1:1:7
for j =1:1:7
C0(i,i)=1;
end
end
for i=1:1:7;
for j=1:1:7;
T(i,j)=0;
end
end
for i=1:1:7;
T(i,i)=1;
end
pivot_i=6;
pivot_j=1;
beta=-(M0(pivot_j,7)/M0(pivot_i,7));
T(pivot_j,pivot_i)=beta;
P1T=transpose(T);
M1=T*M0*P1T;
C1=T*C0*P1T;
M0
beta
T
M1
C0
C1
eig(M0)
eig(M1)
eig(C0)
eig(C1)
===============Results:=======================================
M0 =
1 2 3 4 5 6 7
2 9 10 11 12 13 14
3 10 17 18 19 20 21
4 11 18 25 26 27 28
5 12 19 26 33 34 35
6 13 20 27 34 41 42
7 14 21 28 35 42 49
beta =
-0.1667
T =
1.0000 0 0 0 0 -0.1667 0
0 1.0000 0 0 0 0 0
0 0 1.0000 0 0 0 0
0 0 0 1.0000 0 0 0
0 0 0 0 1.0000 0 0
0 0 0 0 0 1.0000 0
0 0 0 0 0 0 1.0000
M1 =
0.1389 -0.1667 -0.3333 -0.5000 -0.6667 -0.8333 0
-0.1667 9.0000 10.0000 11.0000 12.0000 13.0000 14.0000
-0.3333 10.0000 17.0000 18.0000 19.0000 20.0000 21.0000
-0.5000 11.0000 18.0000 25.0000 26.0000 27.0000 28.0000
-0.6667 12.0000 19.0000 26.0000 33.0000 34.0000 35.0000
-0.8333 13.0000 20.0000 27.0000 34.0000 41.0000 42.0000
0.0000 14.0000 21.0000 28.0000 35.0000 42.0000 49.0000
C0 =
1 0 0 0 0 0 0
0 1 0 0 0 0 0
0 0 1 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 1 0 0
0 0 0 0 0 1 0
0 0 0 0 0 0 1
C1 =
1.0278 0 0 0 0 -0.1667 0
0 1.0000 0 0 0 0 0
0 0 1.0000 0 0 0 0
0 0 0 1.0000 0 0 0
0 0 0 0 1.0000 0 0
-0.1667 0 0 0 0 1.0000 0
0 0 0 0 0 0 1.0000
ans =
0.0000
1.5872
1.9341
2.6120
4.9038
10.7566
153.2063
ans =
152.3052
10.7022
4.9255
0.0000
2.6489
1.9610
1.5961
ans =
1
1
1
1
1
1
1
ans =
0.8466
1.0000
1.0000
1.0000
1.0000
1.0000
1.1811
Remind:
Location of beta is (j,i) not (i,j)
Observation:
eigan values of M are close but not the same
eigan values of C are not the same
Comments