## Description

jacobian(f,v) calculates the Jacobian matrix of f with regard to v. The (*i*,*j*) component of the result is ∂ f(i)∂ v(j).

## Examples

### Jacobian of Vector Function

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, calculate 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] ans = [y * z, x * z, x * y] [0, 2 * y, 0] [1, 0, 1] The Jacobian matrix is invariant to the orientation of the vector in the second input position.Jacobian of Scalar Function The Jacobian of a scalar function is the

transpose of its gradient. Calculate 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]

Now, calculate the gradient of the very same expression.gradient (2 * x+3 * y+4 * z, [x, y, z]

### Jacobian with Respect to Scalar

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

Calculate the Jacobian of [x ^ 2 * y, x * sin(y)] with respect to x.syms x y jacobian( [x ^ 2 * y, x * sin(y)], x)

Now, compute the derivatives.diff ([ x ^ 2 * y, x * sin(y)], x)

## Input Arguments

### f– Scalar or vector function

symbolic expression|symbolic function|symbolic vector

Scalar or vector function, defined as a symbolic expression, function, or vector. If f is a scalar, then the Jacobian matrix of f is the shifted gradient of f.

### v– Vector of variables with respect to which you calculate Jacobian

symbolic variable|symbolic vector

Vector of variables with respect to which you compute Jacobian, specified as a symbolic variable or vector of symbolic variables. If v is a scalar, then the outcome is equal to the transpose of diff(f, v). If v is an empty symbolic things, such as sym( [], then jacobian returns an empty symbolic item.

## More About

### Jacobian Matrix

The Jacobian matrix of the vector function *f* = (*f*1(*x*1, …,*x*n), …,*f*n(*x*1, …,*x*n)) is the matrix of the derivatives of *f*:

J(x1, … xn)= [∂ f1 ∂ x1 ⋯ ∂ f1 ∂ xn ⋮ ⋱ ⋮ ∂ fn ∂ x1 ⋯ ∂ fn ∂ xn]

Introduced prior to R2006a