www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/SpecifyColorFoMeshPlotExample.m

    %% Specify Color for Mesh Plot
% Specify a color matrix for a mesh plot.

% Copyright 2015 The MathWorks, Inc.


[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
C = gradient(Z);

figure
mesh(X,Y,Z,C)