Matlab - jacobian函数

名称:Jacobian matrix 雅可比矩阵
用法:jacobian(f,v)
描述:jacobian(f,v) computes the Jacobian matrix of f with respect to v. The (i,j) element of the result is 
     jacobian(f,v) 计算了 f 关于 v 的雅可比矩阵,其第(i,j )个元素为.


输入参数说明:
f — Scalar or vector function
    symbolic expression | symbolic function | symbolic vector
    标量或者向量函数,符号表达式、符号函数、符号向量等。 
    如果f是一个标量的话,f 的雅可比矩阵是 f 的梯度的转置。


v — Vector of variables with respect to which you compute Jacobian
    symbolic variable | symbolic vector
    要计算雅可比的变量向量,符号变量、符号向量
    如果v 是一个标量,则结果等价于 diff(f,v) 的转置。
    如果v 是空符号对象,比如sym([ ]),则结果返回空符号对象。




例子1: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].
    向量函数的雅可比矩阵式 该函数的偏微分,比如计算 [x*y*z, y^2, x + z] 关于 [x, y, z] 及[x; y; z]的代码及过程分别如下:
    syms x y z
    jacobian([x*y*z, y^2, x + z], [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]


例子2: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].
    标量函数的雅可比为其梯度的转置,比如计算2*x + 3*y + 4*z 关于 [x, y, z]的雅可比的代码及过程如下:
    syms x y
    jacobian([x^2*y, x*sin(y)], x)
    ans =
    [ 2, 3, 4]


    接着计算相同表达式的梯度:
    gradient(2*x + 3*y + 4*z, [x, y, z])
    ans =
    2
    3
    4


例子3: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.
    函数对于一个标量的雅可比矩阵为该函数的一阶微分。
    向量函数对于一个标量的雅可比矩阵式一阶微分的向量。 
    比如,计算[x^2*y, x*sin(y)] 关于 x的雅可比矩阵如下:
    syms x y
    jacobian([x^2*y, x*sin(y)], x)
    ans =
    2*x*y
    sin(y)
    接着,计算微分:
    diff([x^2*y, x*sin(y)], x)
    ans =
    [ 2*x*y, sin(y)]

  • 25
    点赞
  • 81
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值