How to not simplify symbolic expressions?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
David Goodmanson
el 29 de Mzo. de 2018
Editada: David Goodmanson
el 29 de Mzo. de 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.
Respuestas (0)
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!