MATLAB: I had a problem on finding the diagonal values of on the eigen vector

index exceeds matrix dimensions

a=[0 6 1 ; 5 7 8 ; 8 7 2]
a =
0 6 1
5 7 8
8 7 2
>> c=eig(a)
c =
15.4482 + 0.0000i
-3.2241 + 3.0363i
-3.2241 - 3.0363i
>> [V,D] = eig(a)
V =
Columns 1 through 2
0.3269 + 0.0000i 0.1351 - 0.5715i
0.7446 + 0.0000i 0.3232 + 0.3755i
0.5820 + 0.0000i -0.6401 + 0.0000i
Column 3
0.1351 + 0.5715i
0.3232 - 0.3755i
-0.6401 + 0.0000i
D =
Columns 1 through 2
15.4482 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i -3.2241 + 3.0363i
0.0000 + 0.0000i 0.0000 + 0.0000i
Column 3
0.0000 + 0.0000i
0.0000 + 0.0000i
-3.2241 - 3.0363i
for(i=1:1:3)
z=A(i,j)
end

Best Answer

if your problem is to extracting the diagonal elements z = diag(D) is your solution