Skip to content

peaks

plot · scripts/plot/draw/peaks.m

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

Sample the two-variable test function 3*(1-x)^2*exp(-x^2-(y+1)^2) - 10*(x/5-x^3-y^5)*exp(-x^2-y^2) - exp(-(x+1)^2-y^2)/3 on a grid.

Without arguments a 49-by-49 grid on [-3,3] is used, peaks (n) gives an n-by-n grid and peaks (v) uses the vector v for both coordinates. With x and y of one size the function is evaluated elementwise; vectors of different orientation or length span a grid. Without output arguments the surface is drawn.