Version:

Last Modified: March 15, 2017

Evaluates the peak function of two variables.

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] = peakfcn2dLegacy name: peaks

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

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

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

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

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-values at which MathScript evaluates the peak function. X is a matrix.

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

[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