 = pcaPmtk(X);

% visualize basis functions (eigenfaces)
figure(2);clf
subplot(2,2,1)
imagesc(reshape(mu,[h w])); colormap(gray); axis off;
title('mean')
for i=1:3
  subplot(2,2,i+1)
  imagesc(reshape(V(:,i),[h w])); colormap(gray); axis off;
  title(sprintf('principal basis %d', i))
end
printPmtkFigure(sprintf('pcaImages-%s-basis',name));


% Plot reconstruction error
figure(3); clf
n = size(X,1);
Ks = [1:10 10:5:50 50:25:rank(X)];
clear mse
for ki=1:length(Ks)
  k = Ks(ki);
  %Xrecon = U(:,1:k) * S(1:k,1: