jacobian

jacobian calculates the symbolic Jacobian \(df/dx\) of a polynomial \(f(x)\).

Syntax

J = jacobian(f,x)

Examples

With only 1 argument, the differentiation is performed with respect to all involved variables (more precisely, with respect to the variables recover(f)

x1 = sdpvar(1,1);
x2 = sdpvar(1,1);
f = x1^2+5*x2^2;
sdisplay(jacobian(f))
ans =
    '2*x1'   '10*x2'

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

sdisplay(jacobian(f,x2))
ans =
    '10*x2'