hessian calculates the Hessian d2f/dx2 of a polynomial expression

Syntax

H = hessian(f,x)

Examples

With only 1 argument, the differentiation is performed with respect to all involved variables

x1 = sdpvar(1,1);
x2 = sdpvar(1,1);
f = x1^4+5*x2^2;
sdisplay(hessian(f))
ans =
    '12*x1^2'    '0'
    '0'         '10'

Giving a second argument controls what variables to differentiate with respect to

sdisplay(hessian(f,x1))
ans =
    '12x1^2'

See also

jacobian, sdisplay, sdpvar