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)
.
See also: sombrero, meshgrid, mesh, surf.
Package: octave