Surface plot with colormap-based lighting
h = surfl(...)
displays a shaded surface based on a combination of ambient, diffuse,
and specular lighting models.
create three-dimensional shaded surfaces using the default direction
for the light source and the default lighting coefficients for the
vectors or matrices that define the x, y,
and z components of a surface.
a colored, lighted surface using a MATLAB® light object. This
produces results different from the default lighting method,
which changes the color data for the surface to be the reflectance
of the surface.
the direction of the light source.
s is a two-
or three-element vector that specifies the direction from a surface
to a light source.
elevation]. The default
s is 45°
counterclockwise from the current view direction.
the reflectance constant.
k is a four-element vector
defining the relative contributions of ambient light, diffuse reflection,
specular reflection, and the specular shine coefficient.
= [ka kd ks shine] and defaults to
surfl(ax,...) creates the surface in the
axes specified by
ax instead of in the current
gca). The option
precede any of the input argument combinations in the previous syntaxes.
h = surfl(...) returns
the chart surface object. If you specify the
h contains both the surface and the light
Create a surface plot of the
peaks function using colormap-based lighting. Set the
interp to interpolate the colors across lines and faces.
[x,y] = meshgrid(-3:1/8:3); z = peaks(x,y); surfl(x,y,z) shading interp
surfl does not accept complex inputs.
For smoother color transitions, use colormaps that have linear
intensity variations (e.g.,
The ordering of points in the
Z matrices defines the inside and outside of
parametric surfaces. If you want the opposite side of the surface
to reflect the light source, use
Because of the way surface normal vectors are computed,
matrices that are at least 3-by-3.