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

    %% Illuminating Surface Plots with Lights
% This example shows the same surface as the previous examples, but colors it red and removes the mesh lines. A light object is then added to the left of the "camera" (the camera is the location in space from where you are viewing the surface).

% Copyright 2015 The MathWorks, Inc.

[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
surf(X,Y,Z,'FaceColor','red','EdgeColor','none')
camlight left; 
lighting phong
%%
% Lighting is the technique of illuminating an object with a directional light source. In certain cases, this technique can make subtle differences in surface shape easier to see. Lighting can also be used to add realism to three-dimensional graphs.