Problem in returning equation solution for solve()
1 回表示 (過去 30 日間)
古いコメントを表示
Hi I have this code used for inverse kinematics analysis of a manipulator, where i want to check for motor angles to finite number of points. So the solution is to check whether motor angles are real or imaginary values. I have made included some of the function which give me trouble.
%% Beregening af motorvinkler vha. Virtual Link (VL) syms alpha1 alpha2 alpha3 alpha4 b
alphamotor = zeros(4,1); %Opstilling af vector
for i=4:4
vektilnorm =(Motor(1:3,i)+(Roty(beta(i))*Rotz(gamma(i))*Rotx(alpha4)*PL(1:3,i))-MP-PC(1:3,i));
norma = sqrt(vektilnorm(1)^2+vektilnorm(2)^2+vektilnorm(3)^2);
eq = norma^2-VL(i)^2==0;
%eq4 = ((363684746018783151*cos(alpha4))/1801439850948198400 - (8870359658994711*sin(alpha4))/360287970189639680 + 3/100)^2 + ((9068988574485043*cos(alpha4))/360287970189639680 - (221194843280123*sin(alpha4))/72057594037927936 + (2^(1/2)*cos(alpha4))/80 + (41*2^(1/2)*sin(alpha4))/400 - 51/100)^2 + ((4423896865602461*sin(alpha4))/1441151880758558720 - (181379771489700901*cos(alpha4))/7205759403792793600 + (2^(1/2)*cos(alpha4))/80 + (41*2^(1/2)*sin(alpha4))/400 - 7/40)^2 - 4/25 == 0 ((363684746018783151*cos(alpha4))/1801439850948198400 - (8870359658994711*sin(alpha4))/360287970189639680 + 3/100)^2 + ((9068988574485043*cos(alpha4))/360287970189639680 - (221194843280123*sin(alpha4))/72057594037927936 + (2^(1/2)*cos(alpha4))/80 + (41*2^(1/2)*sin(alpha4))/400 - 51/100)^2 + ((4423896865602461*sin(alpha4))/1441151880758558720 - (181379771489700901*cos(alpha4))/7205759403792793600 + (2^(1/2)*cos(alpha4))/80 + (41*2^(1/2)*sin(alpha4))/400 - 7/40)^2 - 4/25 == 0
[alpharesult, param, cond] = solve(eq,alpha4,'ReturnConditions', true);
assume(cond); alpharesultcheck = solve(-pi/2<alpharesult, alpharesult<pi/2, param);
xvalues = subs(alpharesult, alpharesultcheck);
alphamotor(i) = length(xvalues);
end
eq4 is the eqution from the command window got by calcultion of rotation and vectors.
So the problem is when to solve for solutions, if i do by using eq it gives me zero real values. if instead use eq4 (which is a copy of the command window from eq) it gives me the real solution. Have somebody tried something similar?
best regards
0 件のコメント
回答 (0 件)
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!