Vectors must be same lenght
Show older comments
Hi , i've been trying to graph a mechanism degree move from 220 to 270 but i get the error how can i solve ?
AB=200;
BC=480;
CD=480;
DQ=450;
AQ=480;
FB=100;
DE=600;
AF=300;
ED=600;
DC=CD;
x=AQ;
y=DQ;
a2=CD;
a3=BC;
a4=AB;
a1=-x-y;
k1=a1/a2;
k2=a1/a4;
k3=(a1^2+a2^2-a3^2+a4)/((2*a4^2)*a2);
n=1;
theta=220;
while ((theta>=220)&&(theta<=270))
tht(n)=(theta+210)*(pi/180);
K=(-a3^2+a1^2+a4^2+a2^2);
X1=k1*cos(tht(n));
Y1=k2*cos(tht(n));
A=cos(tht(n))*(1-k2)+k3-k1;
B=-2*sin(tht(n));
C=cos(tht(n))*(1+k2)+k3+k1;
stht3=(-B+sqrt(B^2-4*A*C))/(2*A);
tht3(n)=asin(stht3);
tht2(n)=acos((-x+a4*cos(tht3(n))-a3*cos(tht(n)))/a2);
S(n)=AF*sin(tht3(n));
n=n+1;
theta=theta+1;
end
theta=0:+1:360;
figure
plot3(theta,real(S),imag(S))
grid minor
title('S grap.')
xlabel('Q (deg)')
ylabel('S')
n=1;
W=86*9.81;
theta=220;
while((theta>=220)&&(theta<=270))
F_cd(n)=a4*AF*cos(tht3(n));
T(n)=DC*sin(tht2(n)-tht(n))-(DC*cos(tht2(n))*sin(tht3(n)));
F_E(n)=T(n)/(AB*cos(theta*pi/180));
n=n+1;
theta=theta+1;
end
theta=220:+1:270;
figure
plot(theta,T)
grid minor
title('Torque B Grap.')
xlabel('Q(deg)')
ylabel('Torque')
figure
plot(theta,F_E)
grid minor
title('Force A Grap')
xlabel('Q(deg)')
ylabel('Force_A')
Accepted Answer
More Answers (0)
Categories
Find more on Data Import and Export in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

