Name

mesh — Display 3-D mesh surface

Calling Sequence

hdl = mesh(X,Y,Z)

Parameter

X

1 by m matrix or n by m matrix

Y

1 by n matrix or n by m matrix

Z

n by m matrix

hdl

Handle of the created Fac3d entity

Description

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

The axis labels are determined by the range of X, Y and Z, or by a 'axis' property setting. The color of edges and faces is by default respectively foreground/background and can be changed by the properties 'edgecolor' and 'facecolor'.

When x,y and Z are matrices of the same size, surfl(x,y,Z) plots the parametric surface defined by vertices (x(i,j), y(i,j), Z(i,j)).

When x,y are vector arguments you must have length(x) = m and length(y) = n where [n,m] = size(Z).In this case, the vertices of the mesh lines are the triples (x(j), y(i), Z(i,j)). Note that x corresponds to the columns of Z and y corresponds to the rows, example :

x=linspace(-1,1,20); 
y=linspace(-2,2,40);
Z=cos(y'*x);
mesh(x,y,Z);

Note that mesh(Z) use x = 1:m and y = 1:n.

Examples

[u,v]=meshgrid(linspace(0,%pi,30),linspace(0,%pi,30));
mesh(sin(v).*cos(u),sin(v).*sin(u),cos(v),'edgecolor','blue');
hold on
mesh(sin(v).*cos(u),1-sin(v).*sin(u),cos(v),'edgecolor','red');
hold off
axis equal
axis([-1 1 -1 2 -1 1])

Screenshot

See Also

plot , plot3 , suf , surfl

Authors

Stéphane Mottelet