Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Potential of vector field

`potential(V,X)`

`potential(V,X,Y)`

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 the `gradient`

function to verify the result:

simplify(gradient(P, [x y z]))

ans = x y z*exp(z)

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 that `P([0 0 0]) = 0`

:

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

ans = 0

If a vector field is not gradient, `potential`

returns `NaN`

:

potential([x*y, y], [x y])

ans = NaN

If

`potential`

cannot verify that`V`

is a gradient field, it returns`NaN`

.Returning

`NaN`

does not prove that`V`

is not a gradient field. For performance reasons,`potential`

sometimes does not sufficiently simplify partial derivatives, and therefore, it cannot verify that the field is gradient.If

`Y`

is a scalar, then`potential`

expands it into a vector of the same length as`X`

with all elements equal to`Y`

.

`curl`

| `diff`

| `divergence`

| `gradient`

| `hessian`

| `jacobian`

| `laplacian`

| `vectorPotential`