Professional Documents
Culture Documents
2 Marvin Jesse
1.
a)
>> A = [4 -2 -5;1 1 -1;0 0 -1];
>> poly(A)
ans =
1 -4 1 6
>> roots(poly(A))
ans =
3.0000
2.0000
-1.0000
ans =
1 -1 -4 4
>> roots(poly(B))
ans =
-2.0000
2.0000
1.0000
ans =
>> roots(poly(C))
ans =
0
1.0000
0.5000
ans =
1 -4 1 6 0
>> roots(poly(D))
ans =
0
3.0000
2.0000
-1.0000
A=
9 9 1
0 4 4
0 0 9
>> r = roots(poly(A))
r=
9.0000 + 0.0000i
9.0000 - 0.0000i
4.0000 + 0.0000i
>> n = 4;
>> A = triu(fix(10*rand(n)))
A=
7 8 7 7
0 9 3 0
0 0 6 2
0 0 0 0
>> roots(poly(A))
ans =
0
9.0000
7.0000
6.0000
The eigenvalues of an upper triangular matrix are its main diagonal entries.
5.
a)
>> [v,d] = eig(A)
v=
0 0.5774 0.5774
1.0000 -0.5774 0.5774
0 -0.5774 0.5774
d=
-6 0 0
0 4 0
0 0 2
The eigenvalues are -6, 4 and 2 whereas the eigenvectors are [0 1 0], [0.5774 -0.5774 -
0.5774], [0.5774 0.5774 0.5774].
b)
>> [v,d]=eig(B)
v=
0 0.4472 -0.7071
0 0 0.7071
1.0000 -0.8944 0
d=
-1 0 0
0 0 0
0 0 -1
The eigenvalues are -1 and 0 while the eigenvectors are [0 0 1], [0.4472 0 -0.8944], [-0.7071
0.7071 0]