Skip to content

peaks

Built-in 2D test surface (Gaussian-mixture peaks).

[X, Y, Z] = peaks
[X, Y, Z] = peaks(n)
Z = peaks(X, Y)

Returns a 49×49 sample of MATLAB’s classic peaks function — a sum of translated Gaussians used for demoing 3D surface plotting. Pass n for an n × n grid; pass coordinate matrices to evaluate at custom points.

surf(peaks(50)) % the canonical demo
  • surf — 3D surface plot with colored faces.
  • mesh — 3D mesh (wireframe) plot.
  • meshgrid — Generate X, Y coordinate matrices for grid evaluation.