Simplifiy function incorrect result?

4 ビュー (過去 30 日間)
Aston Martin
Aston Martin 2019 年 5 月 20 日
コメント済み: Star Strider 2019 年 5 月 22 日
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

採用された回答

Star Strider
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))

その他の回答 (1 件)

Aston Martin
Aston Martin 2019 年 5 月 22 日
Thanks a lot! :)
  1 件のコメント
Star Strider
Star Strider 2019 年 5 月 22 日
As always, my pleasure!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNumber Theory についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by