MATLAB Homework 2:

Due 22/12/1999

1. Write a MATLAB program that computes the QR Decomposition of an
arbitrary dimensional square matrix A. Test your algorithm on a
3x3 example.

2. Write a MATLAB program that computes the eigenvalues and
eigenvectors of an arbitrary dimensional square matrix A.
Test your algorithm on a 3x3 example.

3. By using your code compute the eigenvalues of the following
two matrices and comment on the results:
A = diag([1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20])
B = A+randn(20,20)*0.00001
where randn is a built-in function of MATLAB.

4. Now find the eigenvalues of the following matrix
A = diag([1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]+randn(1,20)*0.00001)
by using:
(i) the code you wrote in part 2,
(ii) the matlab code for polynomial root finding on the characteristic equation of A.

Comment on the results.