有没有一种方法可以在Matlab中评估Jacobian? [英] Is there a way to evaluate the Jacobian in Matlab?
本文介绍了有没有一种方法可以在Matlab中评估Jacobian?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有此代码:
syms x y z
f =[x^2+y^2+z^2-100 ,x*y*z-1 ,x-y-sin(z)];
v = [x, y, z];
fp = jacobian(f,v)
这给出了:
fp =
[ 2*x, 2*y, 2*z]
[ y*z, x*z, x*y]
[ 1, -1, -cos(z)]
现在,我想以x = y = z = 1进行评估.但是
Now I want to evaluate this at, say, x=y=z=1. But
fp([1,1,1])
给我
[ 2*x, 2*x, 2*x]
有没有办法做到这一点?
Is there a way to do this?
推荐答案
您可以使用subs
函数:
subs(fp, [x y z], [1 1 1])
这篇关于有没有一种方法可以在Matlab中评估Jacobian?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文