Jacoabian doesn't work

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 commentaires

Walter Roberson
Walter Roberson le 20 Mai 2012
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 le 20 Mai 2012
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!

Connectez-vous pour commenter.

 Réponse acceptée

Walter Roberson
Walter Roberson le 20 Mai 2012

0 votes

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)

Plus de réponses (1)

Kim O
Kim O le 20 Mai 2012

0 votes

PERFECT simple solution :) Works fine. Thank You!

Catégories

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by