CalcFourBar

CalcFourBar - D = cos(theta2) - K1 + K4*cos(theta2)+ K5; E...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
% Patel Himen % 21sept2010 function [theta4, theta3]=CalcFourBar(a,b,c,d,theta2,flag) f % INPUT DATA a = 1; % crank (inches) b = 1.5; % coupler (inches) c = 1.75; % rocker (inches) d = 1.6; % Ground (inches) theta2 = 35*(pi/180); % Angle2 flag = input ('open(1) or cross(2)'); f % check val = a*b*c*d; if val <= 0 output = 'Game Over'; else K1 = d/a; K2 = d/c; K3 = (a^2 - b^2 + c^2 + d^2)/(2*a*c); K4 = d/b; K5 = (c^2 - d^2 - a^2 - b^2)/(2*a*b); A = cos(theta2)- K1 - K2*cos(theta2)+ K3; B = -2*sin(theta2); C = K1 - (K2+1)*cos(theta2)+K3;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: D = cos(theta2) - K1 + K4*cos(theta2)+ K5; E = -2*sin(theta2); F = K1 +(K4-1)*cos(theta2)+K5; end if flag == 1 theta4 = 2*atan((-B - sqrt(B^2 - 4*A*C))/(2*A)); if theta4 &lt; 0 theta4 = theta4 + pi; end theta3 = 2*atan((-E - sqrt(E^2 - 4*D*F))/(2*D)); if theta3 &lt; 0 theta3 = theta3 + pi; end else theta4 = 2*atan((-B + sqrt(B^2 - 4*A*C))/(2*A)); if theta4 &lt; 0 theta4 = theta4 +pi; end theta3 = 2*atan((-E + sqrt(E^2 - 4*D*F))^(1/2)/(2*D)); if theta3 &lt; 0 theta3 = theta3 + pi; end end end...
View Full Document

Page1 / 2

CalcFourBar - D = cos(theta2) - K1 + K4*cos(theta2)+ K5; E...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online