img = imread('cat.png');
img = double(img);
A = img(:,:,1)+ img(:,:,2);
A = A/2;

[U, S, V] = svd(A);

colormap gray
image(A);
ri = [20, 10, 5];
for i = 1:length(ri)    
    r = ri(i);
    figure();
    colormap gray
    image(U(:,1:r)*S(1:r,1:r)*V(:,1:r)');
end
