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.

Vector potential of vector field

`vectorPotential(V,X)`

`vectorPotential(V)`

`vectorPotential(`

computes the vector potential of the vector
field
`V`

,`X`

)`V`

with respect to the vector `X`

in Cartesian
coordinates. The vector field `V`

and the vector `X`

are both three-dimensional.

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

:

syms x y z vectorPotential([x^2*y, -1/2*y^2*x, -x*y*z], [x y z])

ans = -(x*y^2*z)/2 -x^2*y*z 0

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

:

syms x y z f(x,y,z) = 2*y^3 - 4*x*y; g(x,y,z) = 2*y^2 - 16*z^2+18; h(x,y,z) = -32*x^2 - 16*x*y^2; A = vectorPotential([f; g; h], [x y z])

A(x, y, z) = z*(2*y^2 + 18) - (16*z^3)/3 + (16*x*y*(y^2 + 6*x))/3 2*y*z*(- y^2 + 2*x) 0

To check whether the vector potential exists for a particular vector field, compute the divergence of that vector field:

syms x y z V = [x^2 2*y z]; divergence(V, [x y z])

ans = 2*x + 3

If the divergence is not equal to 0, the vector potential does
not exist. In this case, `vectorPotential`

returns
the vector with all three components equal to `NaN`

:

vectorPotential(V, [x y z])

ans = NaN NaN NaN