You are on page 1of 4

Matlab 13.

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

The characteristic polynomial is 3-42++6


The eigenvalues are 3, 2 and -1
b)
>> B = [-6 8 1;-4 6 1;0 0 1];
>> poly(B)

ans =

1 -1 -4 4

>> roots(poly(B))

ans =

-2.0000
2.0000
1.0000

The characteristic polynomial is 3-2-4+4


The eigenvalues are -2, 2 and -1
c)
>> C = [-1/2 1 -1/2;-1/2 1 -1/2;0 0 1];
>> poly(C)

ans =

1.0000 -1.5000 0.5000 0

>> roots(poly(C))
ans =

0
1.0000
0.5000

The characteristic polynomial is 3-1.52+0.5


The eigenvalues are 0, 1 and 0.5
d)

>> D = [1 2 0 0;2 1 0 0;0 0 1 1;0 0 1 1];


>> poly(D)

ans =

1 -4 1 6 0

>> roots(poly(D))

ans =

0
3.0000
2.0000
-1.0000

The characteristic polynomial is 4-43+2+6


The eigenvalues are 0, 3, 2 and -1
2.
>> n = 3;
>> A = triu(fix(10*rand(n)))

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]

You might also like