jacobian from trigonometric function

조회 수: 15 (최근 30일)
ves dim
ves dim 2016년 3월 19일
편집: Walter Roberson 2016년 3월 20일
Hi have made this code to calculate the jacobian but the result presents some complex number
is it because matlab convert trigonometric like (cos = eix+e-ix/2) and if it 's that how can i ha ve a trigonometric expression or is it any bug in the code
syms t1;
syms t2;
syms t3;
syms t4;
T1=[cos(t1) -sin(t1) 0 0;sin(t1) cos(t1) 0 0;0 0 1 0;0 0 0 1];
T2=[cos(t2) -sin(t2) 0 90;0 0 1 0;-sin(t2) cos(t2) 0 0;0 0 0 1];
T3=[cos(t3) -sin(t3) 0 0;0 0 1 70;-sin(t3) -cos(t3) 0 0;0 0 0 1];
T4=[cos(t4) -sin(t4) 0 0;0 0 -1 320;sin(t4) -cos(t4) 0 0;0 0 0 1];
T5=[1 0 0 260;0 0 1 0;0 1 0 0;0 0 0 1];
%calcul
T=T1*T2;
T=T*T3;
T=T*T4;
T=T*T5;
px=T(1,4);
py=T(2,4);
pz=T(3,4);
psi=atan2(-T(2,3),T(3,3));
a=(T(2,3)*T(2,3))+(T(3,3)*T(3,3));
phi=atan2(T(1,3),sqrt(a));
teta=atan2(-T(1,3),T(1,1));
J=jacobian([px,py,pz,psi,phi,teta],[t1,t2,t3,t4]);

답변 (2개)

Jan
Jan 2016년 3월 19일
What about
syms t1 real
Otherwise Matlab cannot guess that you want to exclude the imaginary part.

ves dim
ves dim 2016년 3월 19일
Thanks a lot simon it's working

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by