Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Why do I get the "Subscripted assignment dimension mismatch" ?

조회 수: 2 (최근 30일)
hemza khirani
hemza khirani 2018년 6월 12일
마감: MATLAB Answer Bot 2021년 8월 20일
i want do kinematics inverse for 6 dof of robot so i creat programme i put all matrix and i put solve but it did't work some times tell me "Subscripted assignment dimension mismatch" and some times matlab stop working please help me
this is programme
clear all
clc
ang=0:0.5:2*pi;
R=20
X=R*cos(ang)
Y=R*sin(ang)
Z=0
syms t1 t2 t3 t4 t5 t6
a1=[cos(t1) -sin(t1) 0 0;sin(t1) cos(t1) 0 0;0 0 1 450;0 0 0 1];
a2=[sin(t2) 0 cos(t2) 150*sin(t2); -cos(t2) 0 sin(t2) -150*cos(t2) ;0 -1 0 0; 0 0 0 1];
a3=[cos(t3) -sin(t3) 0 900*cos(t3); sin(t3) cos(t3) 0 900*sin(t3) ;0 0 1 0; 0 0 0 1];
a4=[cos(t4) 0 -sin(t4) 115*cos(t4);sin(t4) 0 cos(t4) 115*sin(t4); 0 -1 0 795; 0 0 0 1];
a5=[cos(t5) 0 sin(t5) 0; sin(t5) 0 -cos(t5) 0 ;0 1 0 0; 0 0 0 1];
a6=[-cos(t6) 0 -sin(t6) 0 ; -sin(t6) 0 cos(t6) 0; 0 -1 0 0; 0 0 0 1];
a=a1*a2*a3*a4*a5*a6;
simplify(a)
for i= 1:13
eqn(i) = a==[0 0 0 X(i);0 0 0 Y(i); 0 0 0 Z(i);0 0 0 1]
solx=solve(eqn(i),t1,t2,t3,t4,t5,t6)
end

답변 (1개)

Walter Roberson
Walter Roberson 2018년 6월 13일
That system is inconsistent for i = 1.
You can solve eqn{1}(1,1) for t1 and substitute the result in, getting eqn2. You can solve eqn2 at (1,2) for t3 and substitute the result in, getting eqn3. You can solve eqn3 at (1,3) for t5 and find that t5 == 0.
If you then substitute the t5 == 0 into eqn3, you get division by 0. To proceed any further, you need to take the limit on eqn3 as t5 = 0, getting eqn4. This hints that you potentially have a numeric discontinuity for the situation if you were working numerically, but that mathematically you could proceed. For example sin(t5)/t5 would have a numeric problem but mathematically approaches 1.
eqn4 will then have entries that include -signum(sin(t2)) == 0, 795*signum(sin(t2)) == 0. The solution for those are that t2 = pi*Z1 where Z1 is an arbitrary integer.
Now you substitute t2 == pi*Z1 into eqn4 with assumption Z1 integer, but you will get division by 0. So you need to instead take the limit on eqn4 as t2 == pi*Z1, Z1::integer, getting eqn5.
eqn5 will now include the entries 0 == 20 and undefined == 0. The undefined tells you that the limit as t2 == pi*Z1 is not defined for some of the equations: there is a discontinuity in that situation. But that doesn't really matter because 0 == 20 is always false. You would have needed X(1) = 0 to get a consistent system at that point.... but X(1) = 0 would not be enough to solve the problem of undefined limits under this combination of variables.
You are asking to solve 16 equations in 6 unknowns, but four of the equations are trivial and can be eliminated immediately, giving 12 equations in 6 unknowns. Such systems are often impossible to solve: they only become possible to solve if 6 of the equations turn out to be redundant, leaving you with 6 equations in 6 unknowns.
Solving kinematic equations symbolically often fails: the systems often either have no exact solution or else have two solutions (in 3D) or else have an infinity of solutions.
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 6월 13일
When I worked on solving pieces of this, the numbers 90 and 180 keep cropping up, hinting strongly that at some point you were working in degrees instead of radians but that you did not convert the degrees in your a() entries into radians when you switched to angles in radians.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by