octave: Test Plotting Functions
15.2.11 Test Plotting Functions
-------------------------------
The functions ‘sombrero’ and ‘peaks’ provide a way to check that
plotting is working. Typing either ‘sombrero’ or ‘peaks’ at the Octave
prompt should display a three-dimensional plot.
-- : sombrero ()
-- : sombrero (N)
-- : Z = sombrero (...)
-- : [X, Y, Z] = sombrero (...)
Plot the familiar 3-D sombrero function.
The function plotted is
z = sin (sqrt (x^2 + y^2)) / (sqrt (x^2 + y^2))
Called without a return argument, ‘sombrero’ plots the surface of
the above function over the meshgrid [-8,8] using ‘surf’.
If N is a scalar the plot is made with N grid lines. The default
value for N is 41.
When called with output arguments, return the data for the function
evaluated over the meshgrid. This can subsequently be plotted with
‘surf (X, Y, Z)’.
See also: peaks XREFpeaks, meshgrid XREFmeshgrid,
mesh XREFmesh, surf XREFsurf.
-- : peaks ()
-- : peaks (N)
-- : peaks (X, Y)
-- : Z = peaks (...)
-- : [X, Y, Z] = peaks (...)
Plot a function with lots of local maxima and minima.
The function has the form
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)
Called without a return argument, ‘peaks’ plots the surface of the
above function using ‘surf’.
If N is a scalar, ‘peaks’ plots the value of the above function on
an N-by-N mesh over the range [-3,3]. The default value for N is
49.
If N is a vector, then it represents the grid values over which to
calculate the function. If X and Y are specified then the function
value is calculated over the specified grid of vertices.
When called with output arguments, return the data for the function
evaluated over the meshgrid. This can subsequently be plotted with
‘surf (X, Y, Z)’.
DONTPRINTYET See also: sombrero XREFsombrero, *notemeshgrid:
DONTPRINTYET See also: sombrero XREFsombrero, meshgrid
XREFmeshgrid, mesh XREFmesh, surf XREFsurf.