<html lang="en"> <head> <title>Three-dimensional Geometric Shapes - GNU Octave</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="GNU Octave"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Three_002dDimensional-Plots.html#Three_002dDimensional-Plots" title="Three-Dimensional Plots"> <link rel="prev" href="Three_002ddimensional-Function-Plotting.html#Three_002ddimensional-Function-Plotting" title="Three-dimensional Function Plotting"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Three-dimensional-Geometric-Shapes"></a> <a name="Three_002ddimensional-Geometric-Shapes"></a> <p> Previous: <a rel="previous" accesskey="p" href="Three_002ddimensional-Function-Plotting.html#Three_002ddimensional-Function-Plotting">Three-dimensional Function Plotting</a>, Up: <a rel="up" accesskey="u" href="Three_002dDimensional-Plots.html#Three_002dDimensional-Plots">Three-Dimensional Plots</a> <hr> </div> <h5 class="subsubsection">15.2.2.3 Three-dimensional Geometric Shapes</h5> <!-- cylinder scripts/plot/cylinder.m --> <p><a name="doc_002dcylinder"></a> <div class="defun"> — Function File: <b>cylinder</b><var><a name="index-cylinder-1355"></a></var><br> — Function File: <b>cylinder</b> (<var>r</var>)<var><a name="index-cylinder-1356"></a></var><br> — Function File: <b>cylinder</b> (<var>r, n</var>)<var><a name="index-cylinder-1357"></a></var><br> — Function File: [<var>x</var>, <var>y</var>, <var>z</var>] = <b>cylinder</b> (<var><small class="dots">...</small></var>)<var><a name="index-cylinder-1358"></a></var><br> — Function File: <b>cylinder</b> (<var>ax, <small class="dots">...</small></var>)<var><a name="index-cylinder-1359"></a></var><br> <blockquote><p>Generate three matrices in <code>meshgrid</code> format, such that <code>surf (</code><var>x</var><code>, </code><var>y</var><code>, </code><var>z</var><code>)</code> generates a unit cylinder. The matrices are of size <var>n</var><code>+1</code>-by-<var>n</var><code>+1</code>. <var>r</var> is a vector containing the radius along the z-axis. If <var>n</var> or <var>r</var> are omitted then default values of 20 or [1 1] are assumed. <p>Called with no return arguments, <code>cylinder</code> calls directly <code>surf (</code><var>x</var><code>, </code><var>y</var><code>, </code><var>z</var><code>)</code>. If an axes handle <var>ax</var> is passed as the first argument, the surface is plotted to this set of axes. <p>Examples: <pre class="example"> [x, y, z] = cylinder (10:-1:0, 50); surf (x, y, z); title ("a cone"); </pre> <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dsphere.html#doc_002dsphere">sphere</a>. </p></blockquote></div> <!-- sphere scripts/plot/sphere.m --> <p><a name="doc_002dsphere"></a> <div class="defun"> — Function File: [<var>x</var>, <var>y</var>, <var>z</var>] = <b>sphere</b> (<var>n</var>)<var><a name="index-sphere-1360"></a></var><br> — Function File: <b>sphere</b> (<var>h, <small class="dots">...</small></var>)<var><a name="index-sphere-1361"></a></var><br> <blockquote><p>Generate three matrices in <code>meshgrid</code> format, such that <code>surf (</code><var>x</var><code>, </code><var>y</var><code>, </code><var>z</var><code>)</code> generates a unit sphere. The matrices of <var>n</var><code>+1</code>-by-<var>n</var><code>+1</code>. If <var>n</var> is omitted then a default value of 20 is assumed. <p>Called with no return arguments, <code>sphere</code> call directly <code>surf (</code><var>x</var><code>, </code><var>y</var><code>, </code><var>z</var><code>)</code>. If an axes handle is passed as the first argument, the surface is plotted to this set of axes. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dpeaks.html#doc_002dpeaks">peaks</a>. </p></blockquote></div> <!-- ellipsoid scripts/plot/ellipsoid.m --> <p><a name="doc_002dellipsoid"></a> <div class="defun"> — Function File: [<var>x</var>, <var>y</var>, <var>z</var>] = <b>ellipsoid</b> (<var>xc, yc, zc, xr, yr, zr, n</var>)<var><a name="index-ellipsoid-1362"></a></var><br> — Function File: <b>ellipsoid</b> (<var>h, <small class="dots">...</small></var>)<var><a name="index-ellipsoid-1363"></a></var><br> <blockquote><p>Generate three matrices in <code>meshgrid</code> format that define an ellipsoid. Called with no return arguments, <code>ellipsoid</code> calls directly <code>surf (</code><var>x</var><code>, </code><var>y</var><code>, </code><var>z</var><code>)</code>. If an axes handle is passed as the first argument, the surface is plotted to this set of axes. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dsphere.html#doc_002dsphere">sphere</a>. </p></blockquote></div> </body></html>