 Xrecon = Z(:,1:k)*V(:,1:k)' + repmat(mu, n, 1);
  err = (Xrecon - X);
  mse(ki) = sqrt(mean(err(:).^2));
<span class="keyword">end</span>
plot(Ks, mse, <span class="string">'-o'</span>)
ylabel(<span class="string">'mse'</span>); xlabel(<span class="string">'K'</span>); title(<span class="string">'reconstruction error'</span>);
printPmtkFigure(sprintf(<span class="string">'pcaImages-%s-recon'</span>, name));

<span class="comment">% Scree plot</span>
figure(4);clf
plot(cumsum(evals)/sum(evals), <span class=