function approximation(A)
% APPROXIMATION : plot rank-k approximations of matrix A

[X,D,Y] = svd(A);
d = diag(D);
B = zeros(size(A));
for k = 1:min(size(A))
    B = B + d(k) * X(:,k) * Y(:,k)';
    spynum(B);
    title(sprintf('rank-%d approximation',k));
    pause;
end;
