Main Content

potential

Potential of vector field

Description

example

potential(V,X)computes the potential of the vector fieldVwith respect to the vectorXin Cartesian coordinates. The vector fieldVmust be a gradient field.

example

potential(V,X,Y)computes the potential of vector fieldVwith respect toXusingYas base point for the integration.

Examples

Compute Potential of Vector Field

Compute the potential of this vector field with respect to the vector[x, y, z]:

syms x y z P = potential([x, y, z*exp(z)], [x y z])
P = x^2/2 + y^2/2 + exp(z)*(z - 1)

Use thegradientfunction to verify the result:

simplify(gradient(P, [x y z]))
ans = x y z*exp(z)

Specify Integration Base Point

Compute the potential of this vector field specifying the integration base point as[0 0 0]:

syms x y z P = potential([x, y, z*exp(z)], [x y z], [0 0 0])
P = x^2/2 + y^2/2 + exp(z)*(z - 1) + 1

Verify thatP([0 0 0]) = 0:

subs(P, [x y z], [0 0 0])
ans = 0

Test Potential for Field Without Gradient

If a vector field is not gradient,potentialreturnsNaN:

potential([x*y, y], [x y])
ans = NaN

Input Arguments

collapse all

Vector field, specified as a 3-D vector of symbolic expressions or functions.

Input, specified as a vector of three symbolic variables with respect to which you compute the potential.

Input, specified as a symbolic vector of variables, expressions, or numbers that you want to use as a base point for the integration. If you use this argument,potentialreturnsP(X)such thatP(Y) = 0. Otherwise, the potential is only defined up to some additive constant.

More About

collapse all

Scalar Potential of Gradient Vector Field

The potential of a gradient vector fieldV(X) = [v1(x1,x2,...),v2(x1,x2,...),...]is the scalarP(X)such that V ( X ) = P ( X ) .

The vector field is gradient if and only if the corresponding Jacobian is symmetrical:

( v i x j ) = ( v j x i )

Thepotentialfunction represents the potential in its integral form:

P ( X ) = 0 1 ( X Y ) V ( Y + λ ( X Y ) ) d λ

Tips

  • Ifpotentialcannot verify thatV是一个梯度场,我t returnsNaN.

  • ReturningNaNdoes not prove thatVis not a gradient field. For performance reasons,potentialsometimes does not sufficiently simplify partial derivatives, and therefore, it cannot verify that the field is gradient.

  • IfYis a scalar, thenpotentialexpands it into a vector of the same length asXwith all elements equal toY.

Version History

Introduced in R2012a