n = Z(ndx,1:k)*V(:,1:k)' + mu;
  subplot(2,2,ki);
  imagesc(reshape(Xrecon', h, w)); axis <span class="string">off</span>; colormap(gray)
  title(sprintf(<span class="string">'reconstructed with %d bases'</span>, k))
<span class="keyword">end</span>
printPmtkFigure(sprintf(<span class="string">'pcaImages-%s-reconImages'</span>, name));
</pre><pre class="codeoutput">name =
faces
</pre><img vspace="5" hspace="5" src="pcaImageDemo_01.png" alt=""> <img vspace="5" hspace="5" src="pcaImageDemo_02.png" alt=""> <im