California State University, Long Beach College of Engineering Department of Mechanical Engineering MAE 375-Kinematics Dynamics Mechanisms Instructor: Ali Rezai Lab # 4 Group #6 Student Name Collaboration Daniel Yorba Solidworks graphical analysis, Matlab, and linkage assembly Christopher Saifan Matlab Andrew Reyes Solidworks motion analysis and Matlab Jewel Elassal Matlab Write a Matlab script to determine and plot the coupler curve of point P with respect to the shown coordinate system. Make sure that your plot is properly labeled. In order to come up with the appropriate equations to use in the code the Grashof condition must be checked first: S+L= 0.68+1.82= 2.5 P+Q= 0.85+0.72= 1.57 S+L > P+Q therefore the linkage is class III non-Grashof Matlab code: clc clear all %Givens a=0.72; b=0.68; c=0.85; d=1.82; AP=0.97; Delta_rad=deg2rad(56); Alpha= deg2rad(14); k1=d/a; k4=d/b; k5= (c^2-b^2-a^2-d^2)/(2*a*b); %Using formula 4.37 from page 212 of textbook to solve for theta 2 theta2pos= acos((a^2 + d^2 - b^2 - c^2)/(2*a*d) + (b*c)/(a*d)); theta2neg= acos((a^2 + d^2 - b^2 - c^2)/(2*a*d) - (b*c)/(a*d)); %theta2plus is an imaginary number so we use theta2neg theta2t=theta2neg; theta2td=rad2deg(theta2t); fprintf('Theta 2 = %.3f degrees\n',theta2td); %finding range of motion ROMD= theta2td+theta2td; fprintf('Range of Motion = %.3f degrees\n', ROMD); %I took the linspace from theta2t to theta2t+ROM theta2=linspace(-theta2t,theta2t,500); %Finding other variables D = cos(theta2) - k1 + k4.*cos(theta2) + k5; E = -2.*sin(theta2); F = k1 + (k4 - 1).*cos(theta2) + k5; %Finding theta 3 theta3 = 2 .* atan2(-E - sqrt(E.^2 - 4.*D.*F), 2.*D); %Finding R_A R_A = a*exp(j*theta2 ); %Finding R_PA R_PA = AP*exp(j*(theta3 + Delta_rad)); %We know Rp=R_A+R_PA from equation 4.31 b in 4.11 of the book Rp = R_A + R_PA; %X and Y values of Position before becoming global CouplerPoints = [real(Rp).' imag(Rp).']; %Now finding position vector on our global coordinate system RpG = Rp .* exp(j * Alpha); %Used these equations to check my global translation %X_global = real(Rp) * cos(Alpha) - imag(Rp) * sin(Alpha); %Y_global = real(Rp) * sin(Alpha) + imag(Rp) * cos(Alpha) %X and Y values of Global CouplerPoints = [real(RpG).' imag(RpG).']; %Plotting plot(real(RpG),imag(RpG), 'b') xlabel('Real - X') ylabel('Imaginary - Y') title('Coupler Curve of P') %calculate theta3 and 4 for theta2=0 theta2=0; %link ratios 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; D = cos(theta2)-k1+(k4*cos(theta2))+k5; E = -2*sin(theta2); F = k1+((k4-1)*cos(theta2))+k5; theta3 = 2 * atan((-E) - (sqrt((E^2) - (4 * D * F)))/ (2 * D)) ; theta4 = 2 * atan((-B)- (sqrt((B^2) - (4 * A * C)))/(2*A)); fprintf('Theta 3 when theta 2 is zero degrees = %.3f degrees\n', rad2deg(theta3)); fprintf('Theta 4 when theta 2 is zero degrees = %.3f degrees\n', rad2deg(theta4)); Results: In Solidworks, use the graphical method and find the angle of link 3 and link 4 when the input angle is zero degrees. Input angle 2 with respect to x axis: 0 degrees Input angle 3 with respect to x axis: 50.58 degrees Input angle 4 with respect to x axis: 141.83 degrees Create a Solidworks model of the same fourbar mechanism using the given dimensions. Simulate one full cycle of motion. Trace the coupler curve of point P using the motion study or path trace function. Compare the Solidworks coupler curve with your Matlab plot. The coupler curve generated by matlab seems to be more accurate than the coupler curve generated by the motion study on solidworks. The lines on the second solidworks screenshot represent the toggle positions of the mechanism and the blue dots on the figure are points from the matlab generated coupler curve of point p. The end points generated by the matlab coupler curve are closer to the actual end points of the toggle positions than the solidworks coupler curve. That being said, the points on the matlab coupler curve are similar but not exact to the coupler curve generated by solidworks.