Navigation

Operators and Keywords

Function List:

C++ API

: cylinder
: cylinder (r)
: cylinder (r, n)
: cylinder (hax, …)
: [x, y, z] = cylinder (…)

Plot a 3-D unit cylinder.

The optional input r is a vector specifying the radius along the unit z-axis. The default is [1 1] indicating radius 1 at Z == 0 and at Z == 1.

The optional input n determines the number of faces around the circumference of the cylinder. The default value is 20.

If the first argument hax is an axes handle, then plot into this axis, rather than the current axes returned by gca.

If outputs are requested cylinder returns three matrices in meshgrid format, such that surf (x, y, z) generates a unit cylinder.

Example:

[x, y, z] = cylinder (10:-1:0, 50);
surf (x, y, z);
title ("a cone");

See also: ellipsoid, rectangle, sphere.

Demonstration 1

The following code

 clf;
 colormap ("default");
 [x, y, z] = cylinder (10:-1:0, 50);
 surf (x, y, z);
 title ("cylinder() with linearly shrinking radius produces a cone");

Produces the following figure

Figure 1

Package: octave