Back to Core Functions
peaks
Peaks function (test surface)
Syntax
Z = peaks() Z = peaks(n) [X, Y, Z] = peaks(...)
Description
Generates a test surface with multiple peaks and valleys, commonly used for 3D visualization demos. The function is defined as: Z = 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) evaluated over the range [-3, 3] for both X and Y.
Parameters
| Name | Description |
|---|---|
| n(optional) | Grid size (default: 49). Returns an n×n matrix. |
Returns
n×n NDArray of Z values, or [X, Y, Z] coordinate matrices