Warning: Imaginary part is currently ignored.

조회 수: 2 (최근 30일)
Nikolaos
Nikolaos 2011년 11월 9일
Hello !
I am currently making a small program about the movement of a robotic finger (kinematics). This one is for the inverse kinematics
function [T]=anti_kinimatiko(x,y,f)
global l1 l2 l3
f=f*pi/180;
sigma=(x^2+y^2-l3^2-2*l3*(x*cos(f)+y*sin(f)))/2/l1/l2;
q2=atan2(+sqrt(1-sigma^2),sigma);
num1=(y-l3*sin(f))*(l1+l2*cos(q2))-(x-l3*cos(f))*l2*sin(q2);
den=(l1^2+l2^2+2*l1*l2*cos(q2));
num2=(x-l3*cos(f))*(l1+l2*cos(q2))+(y-l3*sin(f))*l2*sin(q2);
q1=atan2(num1/den,num2/den);
q3=f-q1-q2;
%ta kanw apo aktinia se moires
q1=q1*180/pi;
q2=q2*180/pi;
q3=q3*180/pi;
T=[q1 q2 q3]';
kinimatiko(q1,q2,q3)
axis equal
end
where kinimatiko(q1,q2,q3) is another program for the forward kinematics.
When i run the program the problem i take is this ,
Warning: Imaginary part is currently ignored.
Future behavior of ATAN2 with complex inputs may change.
> In anti_kinimatiko at 10"
What does that mean exactly ,what do i have to change to make it work ?

채택된 답변

Jonathan
Jonathan 2011년 11월 9일
This warning means that one of the inputs to atan2 is imaginary. The two places you use atan2 are extracted below.
q2=atan2(+sqrt(1-sigma^2),sigma);
q1=atan2(num1/den,num2/den);
So, one or more of the arguments to atan2 (namely: +sqrt(1-sigma^2), sigma, num1/den, and num2/den) are imaginary or complex. The most likely candidate is +sqrt(1-sigma^2), since this will be imaginary whenever sigma is greater than 1. Make sure your sigma is properly bounded and try again.
~Jonathan
  댓글 수: 1
Nikolaos
Nikolaos 2011년 11월 9일
Thanks a lot for your answer Jonathan ! I am gonna check this out as soon as i get home ! :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by