% SVD iteration-by-iteration clear clc % load A I = double(imread('Lena.bmp')); [U, S, V] = svd(I); Vtranspose = V'; subplot(1,2,1), imshow(I, [0 255]) % temp = zeros(8); temp = zeros(256); subplot(1,2,2), imshow(temp, [0 255]) for i = 1:256 temp = temp + S(i,i) * U(:,i) * Vtranspose(i,:); subplot(1,2,2), imshow(temp, [0 255]), xlabel(i), if rem(i,5)==0 drawnow end end