Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

gradient (MathScript Function) (Windows, Not in Base Package)

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Member of the vector class.

Syntax

fx = gradient(f, dx)

[fx, fy] = gradient(f, dx, dy)

Description

Computes the gradient function of the input elements.

Details

Examples

Inputs

Name Description
f Specifies the values of the function for which you want to compute the gradient. f is a vector or matrix.
dx Specifies the spacing between points along the x-axis, or between values of the second dimension in a 2D array. dx is an array of real or complex, double-precision, floating-point numbers. The default is 1.
dy Specifies the spacing between points along the y-axis, or between values of the first dimension in a 2D array. dy is an array of real or complex, double-precision, floating-point numbers. The default is 1.

Outputs

Name Description
fx Returns the difference in gradient function values of f with respect to the x-axis, or df/dx. fx has the same dimension and data type as f.
fy Returns the difference in gradient function values of f with respect to the y-axis, or df/dy. fy has the same dimension and data type as f.

Details

You can specify the spacing between the points of the gradient function in two ways. If dx or dy contains only one element, the spacing between two consecutive points in the corresponding axis is constant. If dx or dy contains more than one element, the values of the elements specify the coordinates of the points in the corresponding axis. The length of dx or dy must therefore conform to the corresponding dimension of f.

Examples

F = rand(3, 4)
[Fx, Fy] = gradient(F, [1, 2, 3, 4], [1, 2, 3])

Related Topics

diff


Resources


 

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