function svd2
%pkg load image
rgb=imread("mandelbrot.png" );
gray=rgb2gray(rgb);
figure(1);imshow(gray);
[U, S, V] = svd (gray); 
% sur matlab 
%[U, S, V] = svd(double(gray));
figure(2); plot(diag(S));
compressed=S(1,1)*U(:,1)*V(:,1)';
for i=2:20
  compressed=compressed+S(i,i)*U(:,i)*V(:,i)';
end
figure(3); imshow(uint8(compressed));
end