Function Reference
— 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