Jacoabian doesn't work

2 次查看(过去 30 天)
Kim O
Kim O 2012-5-20
Hello,
I want to calculate
J=jacobian(f_algebr, yss);
But I get Errors. I uploaded my mat file so you can see what f_algebr and yss is.
Thank you
  2 个评论
Walter Roberson
Walter Roberson 2012-5-20
It is faster for us if you tell us what the error message _is_ and which line of code it is on, and if you show us size() and class() of your variables.
Kim O
Kim O 2012-5-20
Hi Walter, you are the only one who is answering me. Thank you! :)
Ok here is the error message:
Error using mupadmex
Error in MuPAD command: Invalid variable. [stdlib::diff]
Error in sym/jacobian (line 33)
Jsym = mupadmex('symobj::jacobian',F.s,x.s);
Error in geosim (line 195)
Jac=jacobian(f_algebr, yss);
%---------------------structure of my variables
f_algebr=[exp(x(9)-x(7) ); x(8)*sin(t) ; ....and so on.....]; % ==> : 13x1 sym
yss=[ x(7), x(8), x(9)]; % ==> 1x3 sym
I think matlab has problems with detecting x(*) as a variable in f_algebr...but I don't know how to solve this problem
Thank you Walter for helping me!

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2012-5-20
In MuPAD, x(7) is to invoke the function x with argument 7. x[7] would be used to index the vector x at its 7th element.
The simplest way to resolve your difficulty would be to subs() variable names such as x1 for x(1)

更多回答(1 个)

Kim O
Kim O 2012-5-20
PERFECT simple solution :) Works fine. Thank You!

类别

Help CenterFile Exchange 中查找有关 Get Started with MuPAD 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by