I can't make A<B, it gives me 'lt' error

조회 수: 3 (최근 30일)
María
María 2013년 4월 22일
Hello! I am trying to make a loop with for inside a for, inside another for, but Matlab gives me this error:
Undefined function or method 'lt' for input arguments of type 'sym'
I've heard it's something about 'less than'.
I tried the program yesterday and it 'worked' (it run the program but my computer is very slow so I cancelled it before it ended, but it worked), but now I am doing the same and it gives me the error.
My loop is that:
for q1=(-185:10:185)*pi/180
for q2=(-135:10:35)*pi/180
for q3=(-120:10:158)*pi/180
J=jacobiana(q1,q2,q3,0,0,0);
D=det(J);
if abs(D)<0.05
P=tcd([q1,q2,q3,0,0,0]);
G=P*[0 0 0 1]';
x(i)=G(1);
y(i)=G(2);
z(i)=G(3);
i=i+1;
end
end
end
end
  댓글 수: 5
Walter Roberson
Walter Roberson 2013년 4월 22일
The "<" operator is implemented by a function named "lt".
Azzi Abdelmalek
Azzi Abdelmalek 2013년 4월 22일
Ok I see

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

채택된 답변

Walter Roberson
Walter Roberson 2013년 4월 22일
What is "jacobiana" ? There is no function of that name in MATLAB or any of the toolboxes.
There is a function "jacobian", which is part of the Symbolic toolbox, and produces a symbolic output, but it uses a different calling sequence and needs to be provided with a variable name; see http://www.mathworks.com/help/symbolic/jacobian.html
You seem to be working with numeric values (unless somehow your 'pi' has become symbolic); the numeric routine most similar to "jacobian" is "gradient"
  댓글 수: 8
Walter Roberson
Walter Roberson 2013년 4월 22일
편집: Walter Roberson 2013년 4월 22일
Why does that code not make use of the passed parameters, q1, q2, q3 ?
Possibly what you want is
J = double( subs( [fx1 fx2 fx3;fy1 fy2 fy3;fz1 fz2 fz3], {q_1, q_2, q_3, q_4, q_5, q_6}, {q1, q2, q3, q4, q5, q6}) );
Note that if that is the case, then for efficiency I would suggest calculating the symbolic matrix only once and just doing the double() of subs() the other times.
persistent J_precalc
if isempty(J_precalc)
.... your current code here, except assign to J_precalc instead of to J ...
end
J = double( subs(J_precalc, {q_1, q_2, q_3, q_4, q_5, q_6}, {q1, q2, q3, q4, q5, q6}) );
María
María 2013년 4월 22일
Yes, it is working now. Thanks for all

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

추가 답변 (1개)

Matt Kindig
Matt Kindig 2013년 4월 22일
Hmmm...I don't see any 'sym' variables here. What is the class() of J and P?
  댓글 수: 3
Matt Kindig
Matt Kindig 2013년 4월 22일
And to confirm, D is a 1x1 double matrix?
María
María 2013년 4월 22일
Yes

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

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by