1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
<html lang="en">
<head>
<title>Test Plotting Functions - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Plotting-Basics.html#Plotting-Basics" title="Plotting Basics">
<link rel="prev" href="Interacting-with-plots.html#Interacting-with-plots" title="Interacting with plots">
<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">
<p>
<a name="Test-Plotting-Functions"></a>
Previous: <a rel="previous" accesskey="p" href="Interacting-with-plots.html#Interacting-with-plots">Interacting with plots</a>,
Up: <a rel="up" accesskey="u" href="Plotting-Basics.html#Plotting-Basics">Plotting Basics</a>
<hr>
</div>
<h4 class="subsection">15.1.8 Test Plotting Functions</h4>
<p>The functions <code>sombrero</code> and <code>peaks</code> provide a way to check
that plotting is working. Typing either <code>sombrero</code> or <code>peaks</code>
at the Octave prompt should display a three-dimensional plot.
<!-- ./plot/sombrero.m -->
<p><a name="doc_002dsombrero"></a>
<div class="defun">
— Function File: <b>sombrero</b> (<var>n</var>)<var><a name="index-sombrero-1104"></a></var><br>
<blockquote><p>Produce the familiar three-dimensional sombrero plot using <var>n</var>
grid lines. If <var>n</var> is omitted, a value of 41 is assumed.
<p>The function plotted is
<pre class="example"> z = sin (sqrt (x^2 + y^2)) / (sqrt (x^2 + y^2))
</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_002dsurf.html#doc_002dsurf">surf</a>, <a href="doc_002dmeshgrid.html#doc_002dmeshgrid">meshgrid</a>, <a href="doc_002dmesh.html#doc_002dmesh">mesh</a>.
</p></blockquote></div>
<!-- ./plot/peaks.m -->
<p><a name="doc_002dpeaks"></a>
<div class="defun">
— Function File: <b>peaks</b> ()<var><a name="index-peaks-1105"></a></var><br>
— Function File: <b>peaks</b> (<var>n</var>)<var><a name="index-peaks-1106"></a></var><br>
— Function File: <b>peaks</b> (<var>x, y</var>)<var><a name="index-peaks-1107"></a></var><br>
— Function File: <var>z</var> = <b>peaks</b> (<var><small class="dots">...</small></var>)<var><a name="index-peaks-1108"></a></var><br>
— Function File: [<var>x</var>, <var>y</var>, <var>z</var>] = <b>peaks</b> (<var><small class="dots">...</small></var>)<var><a name="index-peaks-1109"></a></var><br>
<blockquote><p>Generate a function with lots of local maxima and minima. The function
has the form
<pre class="verbatim">
f(x,y) = 3*(1-x)^2*exp(-x^2 - (y+1)^2) ...
- 10*(x/5 - x^3 - y^5)*exp(-x^2-y^2) ...
- 1/3*exp(-(x+1)^2 - y^2)
</pre>
<p>Called without a return argument, <code>peaks</code> plots the surface of the
above function using <code>mesh</code>. If <var>n</var> is a scalar, the <code>peaks</code>
returns the values of the above function on a <var>n</var>-by-<var>n</var> mesh over
the range <code>[-3,3]</code>. The default value for <var>n</var> is 49.
<p>If <var>n</var> is a vector, then it represents the <var>x</var> and <var>y</var> values
of the grid on which to calculate the above function. The <var>x</var> and
<var>y</var> values can be specified separately.
<!-- 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_002dsurf.html#doc_002dsurf">surf</a>, <a href="doc_002dmesh.html#doc_002dmesh">mesh</a>, <a href="doc_002dmeshgrid.html#doc_002dmeshgrid">meshgrid</a>.
</p></blockquote></div>
</body></html>
|