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!