Question: 1 . 1 Load and prepare the data set [ 1 0 pts ] . There are a total of 1 2 8 8 images
Load and prepare the data set pts
There are a total of images in this data set and each image is a matrix.
Images are typically converted to a single vector of pixel values and are stacked as
columns of the matrix. Therefore, this image data set can be stored as a
matrix, where the is due to The dataset images.mat is available on
Canvas. Load this file to your Matlab workspace:
B l o a d images mat image data ;
and make sure the matrix B is
The original images are in color; we will convert it to grayscale for convenience. This
scales the matrix such that all elements are in You can do this using the
matgray function in Matlab as:
B matgray B ;
Now you should have the matrix ready for further analysis.
Deliverables
Plot the first images of the data set to confirm it matches Figure
To plot images, you must reshape each column of B into a matrix us
ing the reshape function: firstimage reshapeB:
then, use imshow function to plot each image using the reshaped column:
imshowfirstimage to plot an array of images as in Figure use the subplot
function in Matlab.
Compute and plot the eigenvalues pts
We will first compute symmetric matrix from the data set; for this compute A BB
which should be a square matrix. Then, use the eig function in Matlab
to compute both eigenvalues and eigenvectors.
Deliverables
The eig function will produce eigenvalues, but you would see that
eigenvalues are nearly zero. These eigenvalues and
the corresponding eigenvectors are due to numerical error and should be re
moved. Try the index slicing in MATLAB to truncate the arrays of eigenvalues
and eigenvectors that you obtain from eig
Plot the remaining eigenvalues on a loglog plot in decreasing order of mag
nitude that is your plot should show a curve that is decreasing in magnitude
from left to right
Explain what the large and small eigenvalues mean.
Caution: Matlab computes eigenvalues and eigenvectors in reverse order. That is the
first column of U corresponds to the smallest eigenvalue which is the first diagonal
element at in D and so on Therefore, you must reverse this order before
plotting. Check out flip in Matlab.
Plot the eigenvectors pts
Deliverables
From the eigen decomposition you did in the previous part, plot the first
eigenvectors corresponding to the largest eigenvalues. Plot as images. Briefly
explain what you observe from the plots.
Plot the last eigenvectors corresponding to the smallest eigenvalues. Plot
as images. Explain the difference with the plot in the previous step
I really need help on I cannot seem to get the additional plots. Please help me find the code using MATLAB. Thank you
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
