The MATLAB program for calculating the coordinates of E 1 and E 2 is eqnE1

# The matlab program for calculating the coordinates of

This preview shows page 34 - 38 out of 489 pages.

The MATLAB program for calculating the coordinates of E 1 and E 2 is: eqnE1 = ’( xEsol - xC )ˆ2 + ( yEsol - yC )ˆ2 = CEˆ2 ’; eqnE2 = ’(yD-yC)/(xD-xC)=(yEsol-yC )/(xEsol-xC)’; solE = solve(eqnE1, eqnE2, ’xEsol, yEsol’); A D B y C E = E 1 E 2 Circle of radius CE and center at C -0.2 -0.1 0.1 0.2 0.3 0.4 0 0.1 0.2 0.3 0.4 0.5 φ Fig. 2.6 Two solutions for the position of point E 2.3 Four-Bar (R-RRR) Mechanism 25 xEpositions=eval(solE.xEsol); yEpositions=eval(solE.yEsol); xE1 = xEpositions(1); xE2 = xEpositions(2); yE1 = yEpositions(1); yE2 = yEpositions(2); For continuous motion of the mechanism, a constraint condition is needed, x E < x C . Using this condition, the coordinates of the point E are x E = x E 1 = - 0 . 0899m and y E = y E 1 = 0 . 5247m . The MATLAB program for selecting the correct position of E is if xE1 < xC xE = xE1; yE=yE1; else xE = xE2; yE=yE2; end rE = [xE yE 0]; % Position vector of E The angles of the links 2, 3, and 4 with the horizontal are φ 2 = arctan y B - y C x B - x C , φ 3 = arctan y D - y C x D - x C , and in MATLAB phi2 = atan((yB-yC)/(xB-xC)); phi3 = atan((yD-yC)/(xD-xC)); The results are printed using the statements: fprintf(’rA = [ %g, %g, %g ] (m) \ n’, rA) fprintf(’rD = [ %g, %g, %g ] (m) \ n’, rD) fprintf(’rB = [ %g, %g, %g ] (m) \ n’, rB) fprintf(’rC = [ %g, %g, %g ] (m) \ n’, rC) fprintf(’rE = [ %g, %g, %g ] (m) \ n’, rE) fprintf(’phi2 = %g (degrees) \ n’, phi2 * 180/pi) fprintf(’phi3 = %g (degrees) \ n’, phi3 * 180/pi) The graph of the mechanism using MATLAB for φ = π / 4 is given by: plot([xA,xB],[yA,yB],’k-o’,’LineWidth’,1.5) hold on % holds the current plot plot([xB,xC],[yB,yC],’b-o’,’LineWidth’,1.5) hold on plot([xD,xE],[yD,yE],’r-o’,’LineWidth’,1.5) 26 2 Position Analysis -0.2 -0.1 0 0.1 0.2 0.3 0.4 -0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 x (m) y (m) positions for φ = 45 (deg) A = ground B C = ground D = ground E Fig. 2.7 MATLAB graphic of R-RRR mechanism % adds major grid lines to the current axes grid on,... xlabel(’x (m)’), ylabel(’y (m)’),... title(’positions for \ phi = 45 (deg)’),... text(xA,yA,’ \ leftarrow A = ground’,... ’HorizontalAlignment’,’left’),... text(xB,yB,’ B’),... text(xC,yC,’ \ leftarrow C = ground’,... ’HorizontalAlignment’,’left’),... text(xD,yD,’ \ leftarrow D = ground’,... ’HorizontalAlignment’,’left’),... text(xE,yE,’ E’), axis([-0.2 0.45 -0.1 0.6]) The graph of the R-RRR mechanism using MATLAB is shown in Fig. 2.7. The MATLAB program for the positions and the results is given in Appendix A.2. 2.4 R-RTR-RTR Mechanism 27 2.4 R-RTR-RTR Mechanism Exercise The planar R-RTR-RTR mechanism considered is shown in Fig. 2.8. The driver link is the rigid link 1 (the link AB ). The following numerical data are given: AB = 0 . 15 m, AC = 0 . 10 m, CD = 0 . 15 m, DF = 0 . 40 m, and AG = 0 . 30 m. The angle of the driver link 1 with the horizontal axis is φ = 30 . y A C D x B F G 1 2 5 4 3 φ 0 0 Fig. 2.8 R-RTR-RTR mechanism Solution The MATLAB commands for the input data are: AB=0.15; AC=0.10; CD=0.15; %(m) phi=pi/6; %(rad) DF=0.40; AG=0.30; % (m) A Cartesian reference frame xOy is selected. The joint A is in the origin of the ref- erence frame, that is, A O , x A = 0 , y A = 0 .  #### You've reached the end of your free preview.

Want to read all 489 pages?

• Fall '15
• • • 