surfc或者meshc可以绘制类似图,但不是你图上这种效果,其底部是以线显示的等值线图. 你这种图形没有内置函数可以直接绘制,不过你可以使用下面这个函数绘制. 效果: function surfcf(varargin) % 绘制带填充等值线图的曲面图,相当于surf+contourf
hold on % plot the surface surf(varargin{:}); shading interp; %插值阴影模式
% plot filled contour and get handle to hggroup object [C,h] = contourf(varargin{:}); c = get(h, 'Children');
% set the Z-data for each patch object to lower limit of Z-axis zmin = min(zlim); for i = 1:length(c) set(c(i), 'zdata', zmin*ones(size(get(c(i), 'xdata')))); end % 去掉等值线图的线条,只以填充颜色显示 for ii = 1:length(h) set(h(ii), 'LineStyle', 'none'); end
view(-50, 30); %设置3d视角
end
%使用surfcf示例 [X, Y, Z] = peaks(30); surfcf(X, Y, Z); grid on;