Setup and Assumptions:
MATLAB Code:
clear
clc
for i=1:361 %for loop for the first cam
theta=i-1;
thetaplot(i)=theta;
if theta==0 %if the line that intersects the parabola is horizontal,
dist=1.5; %the distance is 1.5cm to the root in the x direction
elseif theta==90 %if the line that intersects the parabola is vertical,
dist=3.4; %the distance is 3.4cm in only the y direction
elseif theta<180 && theta~=0 && theta~=90
liney=sind(180-theta);
linex=cosd(180-theta);
%creates point on intersecting line with unit distance from origin
m=liney/linex; %finds slope of intersecting line
xpos=(-m+sqrt(m^2-(4*(68/45)*-3.4)))/(2*(68/45)); %finds intersection
xneg=(-m-sqrt(m^2-(4*(68/45)*-3.4)))/(2*(68/45)); %finds intersection
if m>0 %if the slope is positive, so is the x-coordinate of the
x=xpos; %intersection between the line and the parabola
else %if the slope is negative, then so is the x-coordinate...
x=xneg;
end
y=m*x; %finds y-coordinate of intersection by plugging into line EQ
dist=sqrt(x^2+y^2); %finds distance using pythagorean theorem
else
dist=1.5; %if theta is anywhere from 180 to 360 deg, radius is 1.5cm
end
disp1(i)=dist-1.5;
%vertical displacement of the shaft is equal to the distance to the
%parabola from the origin minus the radius of the semicircular portion
%of the cam
end
for i=1:361 %for loop for the second cam
theta=i-1;
if theta==180 %if the line that intersects the parabola is horizontal,
dist=1.5; %the distance is 1.5cm to the root in the x direction
elseif theta==270 %if the line that intersects the parabola is vertical,
dist=3.4; %the distance is 3.4cm in only the y direction
elseif theta>180 && theta~=270 && theta~=180
liney=sind(360-theta);
linex=cosd(360-theta);
%creates point on intersecting line with unit distance from origin
m=liney/linex; %finds slope of intersecting line
xpos=(-m+sqrt(m^2-(4*(68/45)*-3.4)))/(2*(68/45)); %finds intersection
xneg=(-m-sqrt(m^2-(4*(68/45)*-3.4)))/(2*(68/45)); %finds intersection
if m>0 %if the slope is positive, so is the x-coordinate of the
x=xpos; %intersection between the line and the parabola
else %if the slope is negative, then so is the x-coordinate...
x=xneg;
end
y=m*x; %finds y-coordinate of intersection by plugging into line EQ
dist=sqrt(x^2+y^2); %finds distance using pythagorean theorem
else
dist=1.5; %if theta is anywhere from 0 to 180 deg, radius is 1.5cm
end
disp2(i)=dist-1.5;
%vertical displacement of the shaft is equal to the distance to the
%parabola from the origin minus the radius of the semicircular portion
%of the cam
end
%plots results
plot(thetaplot,disp1)
hold on
plot(thetaplot,disp2)
title('Vertical Displacement vs Cam Angle')
xlabel('Angle of Cam (deg)')
ylabel('Vertical Displacement of Shafts (cm)')
legend('Cam 1','Cam 2')
Result:
Commentary:
This is the result I expected to see from this analysis based on the shape and positions of the cams. The two cams have a 180 degree phase, meaning they alternate the vertical motion of the dragon’s horns. The actual cams do not ever cause the shafts to dip below the 1.5cm height (0cm displacement), but since I made the approximation that the top half of the cams are parabolas and the bottom halves are semi-circles, the results differ slightly from the actual mechanism’s performance. The actual shape of the cams is too complex to model with basic equations. However, this is a reasonably close approximation (since the peak is completely accurate and the valley is only off by only .03cm), and gives a good general idea of the cam’s displacement profile.