[X,Y,Z] = cylinder(r,n)
[X,Y,Z] = cylinder(r)
[X,Y,Z] = cylinder
cylinder = (...)
cylinder
generates the (x,y,z) coordinates of a unit cylinder for use with surf
or mesh
.
[X,Y,Z] = cylinder(r,n)
returns the (x,y,z) coordinates of a cylinder based on the generator curve in the vector r
. r
contains the radius at equally spaced points along the unit height of the cylinder. The cylinder generated is aligned with the z-axis and can be plotted using either surf
or mesh
(see example below). The cylinder has n
points around the circumference.
[X,Y,Z] = cylinder(r)
, with n
omitted, uses n = 20
.
[X,Y,Z] = cylinder
, with no input arguments, uses n = 20
and r = [1 1]
.
cylinder(...)
, with no output arguments, draws a surf
plot of the cylinder on the screen.
2+cos(t)
:
t = 0:pi/10:2*pi;
[X,Y,Z] = cylinder(2+cos(t));
surf(X,Y,Z)
See Also
sphere
(c) Copyright 1994 by The MathWorks, Inc.