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.

Hessian matrix of scalar function

`hessian(f,v)`

`hessian(`

finds
the Hessian matrix of
the scalar function `f`

,`v`

)`f`

with respect to vector `v`

in
Cartesian coordinates.

If you do not specify `v`

, then `hessian(f)`

finds
the Hessian matrix of the scalar function `f`

with
respect to a vector constructed from all symbolic variables found
in `f`

. The order of variables in this vector is
defined by `symvar`

.

Find the Hessian matrix of a function by using `hessian`

.
Then find the Hessian matrix of the same function as the Jacobian
of the gradient of the function.

Find the Hessian matrix of this function of three variables:

syms x y z f = x*y + 2*z*x; hessian(f,[x,y,z])

ans = [ 0, 1, 2] [ 1, 0, 0] [ 2, 0, 0]

Alternatively, compute the Hessian matrix of this function as the Jacobian of the gradient of that function:

jacobian(gradient(f))

ans = [ 0, 1, 2] [ 1, 0, 0] [ 2, 0, 0]

`curl`

| `diff`

| `divergence`

| `gradient`

| `jacobian`

| `laplacian`

| `potential`

| `vectorPotential`