首先展示效果图!
%制作colormap
colormap([cool(128);gray(64)]);
% 给出需要展示的图形
h(1) = surf(X,Y,Z1);
hold on
%h(2) = pcolor(X,Y,Z);
h(2)=surf(X,Y,Z2);
h(3)= pcolor(X,Y,Z);
hold off
% 移动平面投影部分到底部
set(h(2),'FaceColor','interp')%,'EdgeColor','interp')
set(h(1),'FaceColor','interp')
set(h(3),'ZData',-0.2 + Z*0)
set(h(3),'FaceColor','interp','EdgeColor','interp')
view(3)
%调整colormap
m = 64; % 64-elements is each colormap
cmin = min(Z(:));
cmax = max(Z(:));
% CData for surface
C1 = min(m,round((m-1)*(Z-cmin)/(cmax-cmin))+1);
C2 = 64+C1;
% CData for pcolor
C3=64+C2;
%设置
set(h(1),'CData',C1);
set(h(2),'CData',C2);
set(h(3),'CData',C3);
% 调整z坐标轴区间
caxis([min(C1(:)) max(C3(:))])
参考:http://www.hangzh.com/project_cam