Operands to the || and && operators must be convertible to logical scalar values. What is the error?
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
Hi All, I am writing a following code and I am getting an error. Here is code
s=12/100;
h=1.2/100;
l2=3/100;l3=10/100;l4=6/100;
theta2=ones(1,361,'double');
theta3=ones(1,361,'double');
theta4=ones(1,361,'double');
for i=1:length(theta2)
theta2(i)=(i-1)*pi/180;
theta3(i)=120*pi/180;
theta4(i)=45*pi/180;
end
J1=ones(2,2,'double');
f1=ones(2,1,'double');
norm=1;num=1;
dtheta=zeros(1,2);
for i=1:361
it=1;norm=1;
while norm>0.01 && it<100
J1=[-l3*sin(theta3(i)),l4*sin(theta4(i));l3*cos(theta3(i)),-l4*cos(theta4(i))];
f1=-[s-l4*cos(theta4)+l3*cos(theta3)+l2*cos(theta2);h-l4*sin(theta4)+l3*sin(theta3)+l2*sin(theta2)];
dtheta=inv(J1)*f1;
theta3=dtheta(1,:)+theta3(i);
theta4=dtheta(2,:)+theta4(i);
norm=sqrt(dtheta(1,:).^2+dtheta(2,:).^2);
it=it+1;
end
end
Please help.
Antworten (1)
Azzi Abdelmalek
am 18 Apr. 2014
Use
while norm>0.01 & it<100
norm is a vector, what norm>0.01 means?
2 Kommentare
Sandip More
am 18 Apr. 2014
Azzi Abdelmalek
am 18 Apr. 2014
Bearbeitet: Azzi Abdelmalek
am 18 Apr. 2014
maybe you need
while all(norm>0.01) && it<100
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!