CalcFourBarReady - function[theta3, theta4] =

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: function[theta3, theta4] = CalcFourBar(a,b,c,d,theta2,omega2,flag) %Input Data % theta2=theta2*(pi/180); 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); k A= cos(theta2)-k1-k2*cos(theta2)+k3; B= -2*sin(theta2); C= k1-((k2+1)*cos(theta2))+k3; D= cos(theta2)-k1+(k4*cos(theta2))+k5; E= -2*sin(theta2); F= k1+((k4-1)*cos(theta2))+k5; F if (flag == 1) theta4_crossed = 2*atan((-B-(sqrt((B^2)-(4*A*C))))/(2*A)); if theta4_crossed < 0 theta4= theta4_crossed+pi; else theta4=theta4_crossed; end end e if (flag == 0) theta4_open = 2*atan((-B+(sqrt((B^2)-(4*A*C))))/(2*A)); if theta4_open < 0 theta4= theta4_open+pi; else theta4=theta4_open; end end e if (flag == 1) theta3_crossed = 2*atan((-E-(sqrt((E^2)-(4*D*F))))/(2*D)); if theta3_crossed < 0 theta3= theta3_crossed+pi; else theta3=theta3_crossed; end end e if(flag==0) theta3_open = 2*atan((-E+(sqrt((E^2)-(4*D*F))))/(2*D)); if theta3_open < 0 theta3= theta3_open+pi; else theta3=theta3_open; end end k=1; k for i=linspace(theta2,(2*pi+theta2),200) thetaTwo(k)=i; theta2=thetaTwo(k); A= cos(theta2)-k1-k2*cos(theta2)+k3;...
View Full Document

This note was uploaded on 03/28/2011 for the course CAE 311 taught by Professor Himn during the Spring '11 term at SJVCS.

Page1 / 4

CalcFourBarReady - function[theta3, theta4] =

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