Simplifiy function incorrect result?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Aston Martin
le 20 Mai 2019
Commenté : Star Strider
le 22 Mai 2019
Hello,
I ran into a problem using Matlab simplify function. I have the following code:
syms q1 q2 q3 real
syms l3 l4 real
Ja = [-sin(q1)*(l3*cos(q2)+l4*cos(q2+q3)), -cos(q1)*(l3*sin(q2)+l4*sin(q2+q3)), -l4*cos(q1)*sin(q2+q3)
cos(q1)*(l3*cos(q2)+l4*cos(q2+q3)), -sin(q1)*(l3*sin(q2)+l4*sin(q2+q3)), -l4*sin(q1)*sin(q2+q3)
0, -l3*cos(q2)-l4*cos(q2+q3), -l4*cos(q2+q3)];
detJa = det(Ja);
simplify(detJa)
this code returns:
l3*l4*(l3*cos(q2)*sin(q3) - l4*sin(q2) + l4*cos(q3)^2*sin(q2) + l4*cos(q2)*cos(q3)*sin(q3))
If I calculate this by hand, I get the following result:
l3*l4*sin(q3)*(l3*cos(q2)+l4*cos(q2+q3))
I am pretty sure that this is the correct answer, but why does simplifiy return a different result?
Thanks in advance for any help
0 commentaires
Réponse acceptée
Star Strider
le 20 Mai 2019
You just need to tell simplify to keep simplifying:
DetJa = simplify(detJa, 'Steps',500)
producing:
DetJa =
l3*l4*sin(q3)*(l4*cos(q2 + q3) + l3*cos(q2))
0 commentaires
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Number Theory 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!