%% Computer Lab: Best Basis % Name: % Always a good idea to clear any old variables out: clear clc %% 1. Load the data: load author.mat Y1=double(Y1); %% 2. Visualize the data % (you can comment this out once you've seen it) for j=1:109 imagesc( reshape(Y1(:,j),120,160) ); if j==1 colormap(gray); end M(j)=getframe; end movie(M) %% 3. Compute the mean and visualize as an image: %% 4-5 Visualize the mean-subtracted data as an image % You can skip the visualization step, but not the mean subtraction! %% 5. Find the best basis. %% 6. Visualize the first four basis vectors % Here, I'm assuming they are the columns of a matrix U. figure; %If you want a new figure for j=1:4 subplot(2,2,j) imagesc(reshape(U(:,j),120,160)); end %% 7. Project the data to the first two dimensions, and plot the result.