You are on page 1of 2

MATLAB CODE

theta2 = linspace(0,360,2500);
d= (-103/75)+((5/3)*cosd(theta2))-2;
e= -2*sind(theta2);
f= (-103/75)+((-1/3)*cosd(theta2))+2;
c=-5+((11/6).*cosd(theta2))-(11/30);
b=2*sind(theta2);
a=5+((-1/6).*cosd(theta2))-(11/30);
theta3 = 2.*atand((-e - sqrt((e.^2)-(4.*d.*f)))./(2.*d));
plot(theta2,theta3);
theta4= 2.*atand((-b +sqrt((b.^2)-(4.*a.*c)))./(2.*a));
plot(theta2,theta4);
plot(theta2,theta3,theta2,theta4,'--');
theta3dot = ((-5.*(36.7).*sind(theta4-theta2))./(15.*sind(theta4-theta3)));
plot(theta2,theta3dot);
theta4dot = ((5.*(36.7).*sind(theta3-theta2))./(12.*sind(theta3-theta4)));
plot(theta2,theta4dot);
theta3dbdot = ((theta3dot.^2).*cotd(theta4-theta3))+
(((5.*((36.7).^2).*cosd(theta4-theta2))-(12.*(theta4dot.^2)))./
(15.*sind(theta4-theta3)));
plot(theta2,theta3dbdot);
theta4dbdot = ((theta4dot.^2).*cotd(theta3-theta4))(((5.*((36.7).^2).*cosd(theta3-theta2))-(15.*(theta3dot.^2)))./
(12.*sind(theta3-theta4)));
plot(theta2,theta3dbdot);
subplot(3,1,1);
plot(theta2,theta3,theta2,theta4,'--');
xlabel('\theta_{2} (degree)');
ylabel(sprintf('theta_{3} and\n theta_{4} (degree)'));
legend('\theta_{3}','\theta_{4}');
subplot(3,1,2);
plot(theta2,theta3dot,theta2,theta4dot,'--');
xlabel('\theta_{2} (degree)');
ylabel(sprintf('theta_{3}dot and\n theta_{4}dot (rad/sec)'));
legend('\theta_{3}dot','\theta_{4}dot');

subplot(3,1,3);
plot(theta2,theta3dbdot,theta2,theta4dbdot,'--');
xlabel('\theta_{2} (degree)');
ylabel(sprintf('theta_{3}doubledot and\n theta_{4}doubledot (rad/sec2)'));
legend('\theta_{3}doubledot','\theta_{4}doubledot');

You might also like