MATLAB Code for Peek-a-Bear Analysis
function [t3,d,w3,alpha3,A3,ddot]=slidercrank(a,b,c,t2,w2,alpha2)
t3=asind(-(a*sind(t2)-c)/b)+180;
d=a*cosd(t2)-b*cosd(t3);
w3=(a/b)*(cosd(t2)/cosd(t3))*w2;
alpha3=(a*alpha2*cosd(t2)-a*(w2^2)*sind(t2)+b*(w3^2)*sind(t3))/(b*cosd(t3));
ddot=-a*w2*sind(t2) + b*w3*sind(t3);
A3=-a*alpha2*sind(t2)-a*(w2^2)*cosd(t2)+b*alpha3*sind(t3)+b*(w3^2)*cosd(t3);
end
clear all;
%
a = 1; % Crank length (in)
b = 5; % Coupler length (in)
c =.75; % Offset of slider (in)
t2 =(0:1:360)-90; %t2 with respect to the offset angle
w2=-3;
alpha2=0;
for i = 1:361
[t3(i),d(i),w3(i),alpha3(i),A3(i),ddot(i)]=slidercrank(a,b,c,t2(i),w2,alpha2);
end
figure
plot(t2+90,d)
title('Position of Head')
ylabel('Position of Head (in)')
xlabel('Input Angle (deg)')
figure
plot(t2+90,ddot)
title('Linear Velocity of Head')
ylabel('Linear Velocity of Head (in/s)')
xlabel('Input Angle (deg)')
figure
plot(t2+90,A3)
title('Linear Acceleration of Head')
ylabel('Linear Acceleration of Head (in/s^2)')
xlabel('Input Angle (deg)')
Welcome to the University Wiki Service! Please use your IID (yourEID@eid.utexas.edu) when prompted for your email address during login or click here to enter your EID. If you are experiencing any issues loading content on pages, please try these steps to clear your browser cache.