Name

surf — Display 3-D color surface wih lighting

Calling Sequence

hdl = surf(X,Y,Z)

Parameter

X

1 by n matrix or n by n matrix

Y

1 by n matrix or n by n matrix

Z

n by n matrix

hdl

Handle of the created Fac3d entity

Description

surfl(x,y,Z) plots the colored parametric or non parametric surface defined by three arguments. The view point is specified by the 'view' property (see below), the light by the 'light' property.

The default location of the light source is the point [1 1 1].

x=linspace(-1,1,20); y=linspace(-2,2,40);
Z=cos(y'*x);
surfl(x,y,Z);
surfl(x,y,Z,'axis','off','shading','interp');

Note that surf(Z) uses x = 1:n and y = 1:m. When f is a function/macro and x,y are vectors, surf(x,y,f) plots the parametric or non parametric surface defined by f :

  • if Z has the syntax z=f(x,y) then surfl(x,y,f) plots a non parametric surface,

  • if Z has the syntax [x,y,z]=f(u,v), then surfl(u,v,f) plots a parametric surface,

Examples

u=linspace(0,2*%pi,50);
v=linspace(0,%pi,25);
    
deff('[x,y,z]=sphere(u,v)',['x=sin(v).*cos(u)';...
'y=sin(v).*sin(u)';...
'z=cos(v)']);
 
colormap green
subplot 121;
surfl(u,v,sphere,'shading','interp','axis','equal');
subplot 122;
surfl(u,v,sphere,'shading','interp','axis','equal','light',[0 0 1]);

Screenshot

See Also

plot , plot3 , surf , trisurfl , colormap , shading , caxis

Authors

Stéphane Mottelet