# peakfcn2d

Version:

Evaluates the peak function of two variables.

## Syntax

peakfcn2d
peakfcn2d(n)
peakfcn2d(v)
peakfcn2d(x, y)
Z = peakfcn2d(x, y)
z = peakfcn2d(n)
z = peakfcn2d(v)
[X, Y, Z] = peakfcn2d(v)
[X, Y, Z] = peakfcn2d(n)
[X, Y, Z] = peakfcn2d
Legacy name: peaks

## x

X-values at which to evaluate the peak function. x is a matrix.

## y

Y-values at which to evaluate the peak function. y is a matrix of the same size as x.

## v

X- and y-values at which to evaluate the peak function. v is a matrix.

## n

Number of samples in each dimension of the evaluated function. n is an integer.

## Z

Peak function evaluated at point (x, y). Z is a matrix of the same size as x. If you specify v, Z returns an m-by-m matrix, where m is the length of v. If you specify n, Z returns an n-by-n matrix.

## X

X-values at which MathScript evaluates the peak function. X is a matrix.

## Y

Y-values at which MathScript evaluates the peak function. Y is a matrix.

## Equations

[X, Y, Z] = peakfcn2d(v); Z = peakfcn2d(X, Y);. [X, Y, Z] = peakfcn2d(n) is equivalent to [X, Y, Z] = peakfcn2d(v), where v = -3:6/(n-1):3. [X, Y, Z] = peakfcn2d is equivalent to [X, Y, Z] = peakfcn2d(49). National Instruments recommends that you format x and y like the output of meshgrid2d. MathScript uses the following equation to evaluate the peak: peakfcn2d(x,y) = 1 / (x^2 + y^2 + 0.3) - 1 / ((x - 1.1)^2 + y^2 + 0.4) - 1 / ((x + 0.7)^2 + (y - 1.1)^2 + 0.5) + 1 / ((x + 1.7)^2 + (y + 1.6)^2 + 0.2) + 1 / ((x + 1.4)^2 + (y - 0.7)^2 + 0.34).

[X, Y, Z] = peakfcn2d([1, 2, 3])
[X, Y, Z] = peakfcn2d(3)
[X, Y, Z] = peakfcn2d

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices