How to not simplify symbolic expressions?
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
For a course in Dynamics of Machines I've ran into an issue with the matlab symbolic toolbox. For a simple system I derive the constraint equations expressed in symbolic coordinates in a vector; an example of the eqs is:
sqrt((x2-x1)^2 + (y2-y1)^2)-2*sqrt(2)
This is the input code however matlab changes the equation to:
((x1-x2)^2 + (y1-y2)^2)^(1/2)-2*sqrt(2)
Which should give the same result, however I need the Jacobian of the contstraint vector which means signs will be incorrect in the Jacobian since matlab switched x1 and x2 around. Is there a way to prevent matlab from simplifying these symbolic expressions? Or another solution to this problem?
Thanks in advance!
6 commentaires
David Goodmanson
le 29 Mar 2018
Modifié(e) : David Goodmanson
le 29 Mar 2018
Of course if the roles of x1 and x2 get swapped somehow, x1 <--> x2 before you take the jacobian but the functions stay the same, then there will be a sign change. Or if the functions are swapped and x1 and x2 stay the same.
Réponses (0)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!