W3cubDocs

/Octave

15.2.2.3 Three-dimensional Geometric Shapes

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 axes, 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.

sphere ()
sphere (n)
sphere (hax, …)
[x, y, z] = sphere (…)

Plot a 3-D unit sphere.

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

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

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

Example:

[x, y, z] = sphere (40);
surf (3*x, 3*y, 3*z);
axis equal;
title ("sphere of radius 3");

See also: cylinder, ellipsoid, rectangle.

ellipsoid (xc, yc, zc, xr, yr, zr, n)
ellipsoid (…, n)
ellipsoid (hax, …)
[x, y, z] = ellipsoid (…)

Plot a 3-D ellipsoid.

The inputs xc, yc, zc specify the center of the ellipsoid. The inputs xr, yr, zr specify the semi-major axis lengths.

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 axes, rather than the current axes returned by gca.

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

See also: cylinder, rectangle, sphere.

© 1996–2018 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/interpreter/Three_002ddimensional-Geometric-Shapes.html