manpagez: man pages & more
info octave
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

15.1.8 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.

Function File: sombrero (n)

Produce the familiar three-dimensional sombrero plot using n grid lines. If n is omitted, a value of 41 is assumed.

The function plotted is

 
z = sin (sqrt (x^2 + y^2)) / (sqrt (x^2 + y^2))

See also: surf, meshgrid, mesh.

Function File: peaks ()
Function File: peaks (n)
Function File: peaks (x, y)
Function File: z = peaks (…)
Function File: [x, y, z] = peaks (…)

Generate 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 mesh. If n is a scalar, the peaks returns the values of the above function on a 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 x and y values of the grid on which to calculate the above function. The x and y values can be specified separately.

See also: surf, mesh, meshgrid.


© manpagez.com 2000-2017
Individual documents may contain additional copyright information.