Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.1.0 - Français


peaks

Computes values of a function with lots of local maxima and minima.

Syntax

[XX, YY, ZZ] = peaks()
[XX, YY, ZZ] = peaks(n)
[XX, YY, ZZ] = peaks(x, y)
ZZ = peaks(...)

Arguments

n

Grid size. Default value is 49.

x

Grid over X-axis.

y

Grid over Y-axis.

XX, YY, ZZ

Computed coordinates.

Description

peaks returns the Cartesian coordinates of peaks function (without drawing it). The returned coordinates can be then plotted using surf. If n is a scalar, then coordinates are computed over a n x n grid. If n is a vector, then the coordinates are computed over a grid defined by n values (used for X-axis and Y-axis). When called with two input arguments, peaks computed coordinates over a grid defined by x values (for X-axis) and by y values (for Y-axis).

When called with only one output argument, peaks returns only z-coordinates.

The peaks function is defined as

z = 3(1-x)^2e^{-x^2-(y+1)^2}-10(\frac{x}{5}-x^3-y^5)e^{-x^2-y^2}-\frac{1}{3}e^{-(x+1)^2-y^2}

Examples

[x, y, z] = peaks(-4:0.2:4);
surf(x, y, z);
gcf().color_map = jet(64);

See also

  • surf — 3D surface plot

History

VersionDescription
2025.1.0 Function peaks introduced.
Report an issue
<< param3d properties 3d_plot plot3d >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu May 22 12:54:25 CEST 2025