jacobian
Jacobian matrix of symbolic function
Syntax
Description
jacobian(
computes
the Jacobian matrix of symbolic
function f
,v
)f
with respect to v
. The (i,j) element of the result is .
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 =
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])
ans =
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.
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 =
Now, compute the gradient of the same expression.
gradient(2*x + 3*y + 4*z,[x,y,z])
ans =
Jacobian with Respect to Scalar
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 =
Now, compute the derivatives.
diff([x^2*y,x*sin(y)],x)
ans =
Jacobian of Coordinate Change
Specify polar coordinates , , and that are functions of time.
syms r(t) phi(t) theta(t)
Define the coordinate transformation form spherical coordinates to Cartesian coordinates.
R = [r*sin(phi)*cos(theta), r*sin(phi)*sin(theta), r*cos(phi)]
R(t) =
Find the Jacobian of the coordinate change from spherical coordinates to Cartesian coordinates.
jacobian(R,[r,phi,theta])
ans(t) =
Input Arguments
f
— Scalar or vector function
symbolic expression | symbolic function | symbolic vector
Scalar or vector function, specified as a symbolic expression, function, or vector.
If f
is a scalar, then the Jacobian matrix of
f
is the transposed gradient of f
.
v
— Vector of variables or functions with respect to which you compute Jacobian
symbolic variable | symbolic function | symbolic vector
Vector of variables or functions with respect to which you compute Jacobian,
specified as a symbolic variable, symbolic function, or vector of symbolic variables. If
v
is a scalar, then the result is equal to the transpose of
diff(f,v)
. If v
is an empty symbolic object,
such as sym([])
, then jacobian
returns an empty
symbolic object.
More About
Jacobian Matrix
The Jacobian matrix of the vector function f = (f1(x1,...,xn),...,fn(x1,...,xn)) is the matrix of the derivatives of f:
Version History
Introduced before R2006a
See Also
curl
| divergence
| diff
| gradient
| hessian
| laplacian
| potential
| vectorPotential
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)