%This example mostly demonstrates the shaded relief functions
%"shade_relief_fn" and "shaded_rgbmake".  
%Perspective viewing and zooming is also demonstrated.
%
%Peter Shaw, WHOI

N=100;
z=abs(peaks(N))+rand(N)/4;
g=-[zeros(N,1) z(:,2:N)-z(:,1:N-1)];
[rgb_index, rgb_map]=shade_relief_fn(z,0,6,g,-.5,.5,270:-15:0);
image(rgb_index); colormap(rgb_map)
pause

surf(1:N,1:N,z,rgb_index); 
caxis([1 size(rgb_map,1)]); shading flat; colormap(rgb_map)
axis([0 N 0 N 0 30])
grid on

%Set up perspective view:
A=viewmtx(-60,10,110);
view(A)
%zoom in on part of the data:
set(gca,'pos',[-.2 0 1.4 1.4]);
