Simplifiy function incorrect result?
4 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Star Strider
2019 年 5 月 20 日
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 件のコメント
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Number Theory についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!