clear all
load gatlin
 image(X); colormap(map);
 [U,S,V]=svd(X);
 [m,n]=size(X)
 k=min(m,n);
 a = zeros(k,1);
 for i=1:k
    a(i)=S(i,i);
 end
 for mm = 20:20:280
    figure
    %mm = 22;
    U1=U(:,1:mm);
    V1=V(:,1:mm);
    S1=zeros(1:mm,1:mm);
    for i=1:mm
       S1(i,i)=S(i,i);
    end
    X1=U1*S1*V1';
    image(X1), colormap(map);
 end
  
 
 