Description
1. (a) Write a computer program to implement the spectral method for solving A
#»x =
#»b .
(b) In your program, test whether the eigenvectors of A are orthogonal.
(c) Program inputs: For any m: 1. matrix A ∈ R
m×m; 2. vector
#»b ∈ R
m×1
.
(d) Program output: 1. unknown vector #»x ∈ R
m×1
.
(e) Test your program with the following inputs:
i. A =
−2 1 0 0 0 0 0 0 0
1 −2 1 0 0 0 0 0 0
0 1 −2 1 0 0 0 0 0
0 0 1 −2 1 0 0 0 0
0 0 0 1 −2 1 0 0 0
0 0 0 0 1 −2 1 0 0
0 0 0 0 0 1 −2 1 0
0 0 0 0 0 0 1 −2 1
0 0 0 0 0 0 0 1 −2
9×9
ii. #»b =
−0.01
−0.01
−0.01
−0.01
−0.01
−0.01
−0.01
−0.01
−0.01
9×1
Page 1 of 2
2. (a) Write a general computer program to implement the reduced singular value
decomposition (reduced SVD) method of a matrix A ∈ R
m×n with n << m.
(b) Input: Use images of a scene under three different illumination to form the data matrix
A as follows. Recall that images can be read using MATLAB function imread() and
that a grayscale image is in a matrix form. Let I1, I2, I3 are the three image matrices.
Vectorize the image matrices (using the colon operator, e.g. #»a 1 = I1(:)). Form A with
#»a 1,
#»a 2,
#»a 3 as column entries of A.
(c) Example Input: Use the attached images Image1.jpg, Image2.jpg, Image3.jpg to
test your reduced SVD method and to answer the following questions. You are also
encouraged to collect your own images (of various scenes, various illuminations, and
various number of images).
(a) Image1.jpg (b) Image2.jpg (c) Image3.jpg
(d) Show that the left singular vectors in the U matrix form an orthogonal set.
(e) Show that the left singular vectors in U span the images in the data matrix A.
(f) Create at least six new images using the left singular vectors in U that are not in the
original data matrix A. Save your images using imwrite() as
Image4.jpg, Image5.jpg, …, Image9.jpg.
Hint: Use the concepts of basis, span and vector space.