surfl

Purpose

3-D shaded surface with lighting.

Synopsis

surfl(Z)
surfl(x,y,Z)
surfl(Z,s)
h = surfl(x,y,Z,s)
h = surfl(...)

Description

surfl produces a shaded surface plot based on a combination of diffuse, specular and ambient lighting models. View the surfaces with a grayscale or similar colormap (such as gray, copper, bone, pink) and with interpolated shading.

surfl(Z), surfl(x,y,Z), surfl(Z,s), and surfl(x,y,Z,s) are used the same way as surf(...), but accept an optional trailing argument s. Argument s, if specified, is a three-element vector s = [Sx Sy Sz] that specifies the direction of the light source. s can also be specified in spherical coordinates, s = [azimuth,elevation].

h = surfl(...) returns a handle to a surface object.

The default value for s is 45° counterclockwise from the current view direction. s points from the object to the light source.

Examples

A view of the peaks function, with a light source, is

[x,y] = meshgrid(-3:1/8:3);
z = peaks(x,y);
surfl(x,y,z);
shading interp
colormap(gray);
axis([-3  3  -3  3  -8  8])
          

See Also

colormap, diffuse, shading, specular

(c) Copyright 1994 by The MathWorks, Inc.