%% Clown demo %% % First, we load and visualize the demo matrix load clown size(X) figure(1) image(X) colormap(map) %% % We compute the SVD of the matrix [U,S,V] = svd(X); %% % Now let's have a look at the singular values s = diag(S); figure(2) plot(s,'.') ylabel('Singular values') %% % Apparently just the first few singular values are significantly different % from zero. Let's now assemble an approximating matrix by using just the % terms corresponding to the few largest singular values. k = 10 Xred = U(:,1:k)*S(1:k,1:k)*V(:,1:k)'; figure(3) image(Xred) colormap(map)