Jacobian matrix

`jacobian(f,v)`

example

`jacobian(`

computes
the Jacobian Matrix of `f`

,`v`

)`f`

with
respect to `v`

. The (*i*,*j*) element
of the result is $$\frac{\partial f\left(i\right)}{\partial \text{v}\left(j\right)}$$.

The Jacobian of a vector function is a matrix of the partial derivatives of that function.

Compute the Jacobian matrix of `[x*y*z, y^2, x + z]`

with
respect to `[x, y, z]`

.

syms x y z jacobian([x*y*z, y^2, x + z], [x, y, z])

ans = [ y*z, x*z, x*y] [ 0, 2*y, 0] [ 1, 0, 1]

Now, compute the Jacobian of `[x*y*z, y^2, x + z]`

with
respect to `[x; y; z]`

.

jacobian([x*y*z, y^2, x + z], [x; y; z])

The Jacobian of a scalar function is the transpose of its gradient.

Compute the Jacobian of `2*x + 3*y + 4*z`

with
respect to `[x, y, z]`

.

syms x y z jacobian(2*x + 3*y + 4*z, [x, y, z])

ans = [ 2, 3, 4]

Now, compute the gradient of the same expression.

gradient(2*x + 3*y + 4*z, [x, y, z])

ans = 2 3 4

The Jacobian of a function with respect to a scalar is the first derivative of that function. For a vector function, the Jacobian with respect to a scalar is a vector of the first derivatives.

Compute the Jacobian of `[x^2*y, x*sin(y)]`

with
respect to `x`

.

syms x y jacobian([x^2*y, x*sin(y)], x)

ans = 2*x*y sin(y)

Now, compute the derivatives.

diff([x^2*y, x*sin(y)], x)

ans = [ 2*x*y, sin(y)]

`curl`

| `diff`

| `divergence`

| `gradient`

| `hessian`

| `laplacian`

| `potential`

| `vectorPotential`

Was this topic helpful?