% Penny512
% Copies from Mathworks 22 Oct 2015

% Load the Penny Data
 load penny512.mat
   P = double(flipud(P));
   
% Copper Color Map
% The copper colormap is just a linear ramp of rgb values up to a copper color.

 set(gcf,'renderer','zbuffer')
   colormap(copper)
   rgbplot(copper)
   title('copper color map')
   
% Surf Plot
% Our first view of the data is a surface plot, with lighting and shading. You have to realize this is not a photograph of a penny. It is a top down view of a three-dimensional surface plot of the depth data obtained from the scanning stylus. The placement of the light and calculation of its reflections are critical.

pause
surf(P);
   shading interp
   material metal
   lighting gouraud
   daspect([1,1,20])
   axis tight
   axis off
   set(gca,'zlimmode','auto','climmode','manual');
   light('pos',[1,1,2000],'style','inf');
   view(2)

% Zoom in on the date. You can see the striations resulting from the scanning action. 

pause
surf(P(50:130,360:490));
   shading interp
   material metal
   lighting gouraud
   daspect([1,1,20])
   axis tight
   axis off
   set(gca,'zlimmode','auto','climmode','manual');
   light('pos',[1,1,2000],'style','inf');
   view(2)
   
% Now display a contour plot with 20 copper colored contour levels.

pause
   contour(P,20)
   axis square
   axis off

% Here is a closer three dimensional view with tiny points on the surface.

pause
 surf(P,'facecolor','none','edgecolor','none',...
      'marker','.','markeredgecolor','flat','markersize',1);
   daspect([1,1,20])
   axis tight
   axis off
   set(gca,'zlimmode','auto');
   camzoom(3);