Main Content

Create cylinder

`[X,Y,Z] = cylinder`

returns three
`2`

-by-`21`

matrices containing the
*x*-, *y*-, and *z*-
coordinates of a cylinder without drawing it. The cylinder has a radius of 1 and
20 equally spaced points around its circumference. The bases are parallel to the
*xy*-plane.

To draw the cylinder, pass `X`

, `Y`

, and
`Z`

to the `surf`

or
`mesh`

function.

`[X,Y,Z] = cylinder(`

returns the
`r`

)*x*-, *y*-, and *z*-
coordinates of a cylinder with the specified profile curve,
`r`

, and 20 equally spaced points around its
circumference. The function treats each element in `r`

as a
radius at equally spaced heights along the unit height of the cylinder. The size
of each coordinate matrix is `m`

-by-`21`

,
where `m=numel(r)`

. However, if `r`

is a
scalar, then `m=2`

.