-Matlab Code-

mechanicalAdvantage.m

function[gapSize,m,Vout,Vout_x,Vout_y,x_out,y_out] = mechanicalAdvantage(theta1,omega1,a,b,c,h,k,g,i,j,alpha1,alpha2,alpha3,theta2)
gamma2=pi-theta1-alpha2;
gamma1=pi-gamma2;

d=c*sin(gamma2);
e=c*cos(gamma2);

beta1=asin((d-g)/k);
beta2=pi/2-beta1;

theta4=asin(i/h);
theta3=pi-theta2+beta1-theta4;

f=k*cos(beta1);

x_out=h*cos(theta3);
y_out=g-h*sin(theta3);
gapSize=2*y_out;

omega2=c/k*cos(gamma2)/cos(pi-beta1)*omega1;

Vout_x=h*omega2*sin(theta3);
Vout_y=h*omega2*cos(theta3);

Vin_x=k*omega2*sin(beta1)+a*omega1*sin(alpha3+gamma1);
Vin_y=-k*omega2*cos(beta1)+a*omega1*cos(alpha3+gamma1);

Vout=sqrt(Vout_x^2 + Vout_y^2);
Vin=sqrt(Vin_x^2 + Vin_y^2);

m=Vin/Vout;
end

velocity.m

function [y_out,m,omega2,theta3,beta1,gamma1,Vin,Vout] = velocity(inputArg1,inputArg2)
gamma2=pi-theta1-alpha2;
gamma1=pi-gamma2;

d=c*sin(gamma2);
e=c*cos(gamma2);

beta1=asin((d-g)/k);
beta2=pi/2-beta1;

theta4=asin(i/h);
theta3=pi-theta2+beta1-theta4;

f=k*cos(beta1);

y_out=g-h*sin(theta3);

omega2=c/k*cos(gamma2)/cos(pi-beta1)*omega1;

Vout_x=h*omega2*sin(theta3);
Vout_y=h*omega2*cos(theta3);

Vin_x=k*omega2*sin(beta1)+a*omega1*sin(alpha3+gamma1);
Vin_y=-k*omega2*cos(beta1)+a*omega1*cos(alpha3+gamma1);

Vout=sqrt(Vout_x^2 + Vout_y^2);
Vin=sqrt(Vin_x^2 + Vin_y^2);

m=Vin/Vout;
end


FinalProject.m

clear all;
clc;

a=14.25;
b=13.875;
c=1.125;
h=1.5;
k=3.6;
g=.9375;
i=.9407;
j=1.1684;

alpha1=deg2rad(4.3229);
alpha2=deg2rad(107.2953);
alpha3=deg2rad(68.3817);

theta2=deg2rad(103.551);

theta1_max=deg2rad(72);
omega1=1;

ii=1;
theta1_(1)=theta1_max;
while theta1_(ii)>0
[gapSize,m,Vout,Vout_x,Vout_y,x_out,y_out]=mechanicalAdvantage(theta1_(ii),omega1,a,b,c,h,k,g,i,j,alpha1,alpha2,alpha3,theta2);
if gapSize>0
gapSize_(ii)=gapSize;
m_(ii)=m;
Vout_(ii)=Vout;
Vout_x_(ii)=Vout_x;
Vout_y_(ii)=Vout_y;
x_out_(ii)=x_out;
y_out_(ii)=y_out;
end
ii=ii+1;
theta1_(ii)=theta1_max-deg2rad(ii);
end
theta1_=rad2deg(2*theta1_(1:length(m_)));

figure(1);
plot(theta1_,m_);
title('Mechanical Advantage vs. Angle Between Handles');
xlabel('Angle Between Handles (deg)');
ylabel('Mechanical Advantage');
xlim([0,180]);

figure(2);
plot(gapSize_,m_);
title('Mechanical Advantage vs. Material Thickness');
xlabel('Material Thickness (in)');
ylabel('Mechanical Advantage');

figure(3);
plot(theta1_,Vout_,theta1_,Vout_x_,theta1_,Vout_y_);
title('Jaw Velocity vs. Angle Between Handles');
xlabel('Angle Between Handles (deg)');
ylabel('Velocity (in/s)');
xlim([0,180]);
legend({'Speed','Horizontal Velocity','Vertical Velocity'},'Location','southwest');
xlim([0,180]);

bottomy_=-y_out_;
figure (4)
plot(x_out_,y_out_,x_out_,bottomy_);
title('Path of Jaws Across Range of Motion');
xlabel('Horizontal Position (in)');
ylabel('Vertical Position (in)');