Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

peakfcn2d (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

Owning Class: matrix

Requires: MathScript RT Module

Syntax

peakfcn2d

peakfcn2d(n)

peakfcn2d(v)

peakfcn2d(x, y)

Z = peakfcn2d(x, y)

[X, Y, Z] = peakfcn2d(v)

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

[X, Y, Z] = peakfcn2d

Legacy Name: peaks

Description

Evaluates the peak function of two variables. If you do not request an output, this function plots a peak surface in the current plot window.

Details

Examples

Inputs

Name Description
x Specifies the x-values at which to evaluate the peak function. x is a matrix.
y Specifies the y-values at which to evaluate the peak function. y is a matrix of the same size as x.
v Specifies the x- and y-values at which to evaluate the peak function. v is a matrix.
n Specifies the number of samples in each dimension of the evaluated function. n is an integer.

Outputs

Name Description
Z Returns the 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 Returns the x-values at which LabVIEW evaluates the peak function. X is a matrix.
Y Returns the y-values at which LabVIEW evaluates the peak function. Y is a matrix.

Details

[X, Y, Z] = peakfcn2d(v) is equivalent to [X, Y] = meshgrid2d(v, 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.

LabVIEW 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).

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes (if you request output)
Supported on RT targets Yes (if you request output)
Suitable for bounded execution times on RT Not characterized

Examples

[X, Y] = meshgrid2d([1, 2, 3], [0.5, 1.5, 2.5]);
Z = peakfcn2d(X, Y)

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

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

[X, Y, Z] = peakfcn2d

Related Topics

meshgrid2d


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit