How do i make the 2D plot obtained from the following code to 3D? It should look like a gear. I didn't used Cad software b/c firstly i have limited set of inputs and then getting the outputs from the following code to make this gear profile.
4 views (last 30 days)
Show older comments
% %Gear 1
phi = input ('Enter the value of Pressure Angle(phi)\n');
G = input ('Enter the value of Gear Ratio(G)\n');
L = input ('Enter the value of Centre distance(L)\n');
Np = input ('Enter the value of Pinion Speed(Np)\n');
Y = 1;
N = 0;
% phi=20; G=2; L=0.6; Np=300;
Curvature = input('Is the value of Tp given? (Y/N) \n');
if(Curvature == 1)
Tp = input ('Enter the value of Number of teeth in pinion(Tp)\n');
elseif(Curvature == 0)
Tp = 2/(G*(sqrt(1+(1/G)*(1/G+2)*sind(phi)*sind(phi))-1));
Tp = ceil(Tp);
end
CI = 1;
SS = 2;
PB = 3;
S = 4;
pinion = input ('Enter the material for pinion\n');
gear = input ('Enter the material for gear\n');
if(pinion == 1)
S0p = 10500000;
Sep = 84000000;
Ep = 180000000000;
elseif(pinion == 2)
S0p = 465000000;
Sep = 126000000;
Ep = 200000000000;
elseif(pinion == 3)
S0p = 84000000;
Sep = 168000000;
Ep = 110000000000;
elseif(pinion == 4)
S0p = 180000000;
Sep = 252000000;
Ep = 193000000000;
end
if(gear == 1)
S0g = 105000000;
Seg = 84000000;
Eg = 180000000000;
elseif(gear == 2)
S0g = 465000000;
Seg = 126000000;
Eg = 200000000000;
elseif(gear == 3)
S0g = 84000000;
Seg = 168000000;
Eg = 110000000000;
elseif(gear == 4)
S0g = 180000000;
Seg = 252000000;
Eg = 193000000000;
end
Tg = G*Tp;
Ng = Np/G;
Dp = 2*L/(G+1);
Dg = G*Dp;
m = Dp/Tp;
if(m>=2.5*10^(-3) && m<=3*10^(-3))
m = 3*10^(-3);
elseif(m>=3*10^(-3) && m<=4*10^(-3))
m = 4*10^(-3);
elseif(m>=4*10^(-3) && m<=5*10^(-3))
m = 5*10^(-3);
elseif(m>=5*10^(-3) && m<=6*10^(-3))
m = 6*10^(-3);
elseif(m>=6*10^(-3) && m<=8*10^(-3))
m = 8*10^(-3);
elseif(m>=8*10^(-3) && m<=10*10^(-3))
m = 10*10^(-3);
elseif(m>=10*10^(-3) && m<=12*10^(-3))
m = 12*10^(-3);
elseif(m>=12*10^(-3) && m<=16*10^(-3))
m = 16*10^(-3);
elseif(m>=16*10^(-3) && m<=21*10^(-3))
m = 20*10^(-3);
end
Curvature = input ('Is Face Width given? (Y/N) \n');
if(Curvature == 1)
b = input ('Enter the value of Face Width(b)\n');
elseif(Curvature == 0)
b = 10*m;
end
v = pi*Dp*Np/60;
Cv = .75/(.75+sqrt(v));
yp = 0.154 - 0.912/Tp;
yg = 0.154 - 0.912/Tg;
Curvature = input ('Is the value of Power(P) given? (Y/N) \n');
if (Curvature == 0)
if (S0p*yp <= S0g*yg)
Wt = S0p*Cv*b*pi*m*yp;
Ws = Sep*b*pi*m*yp;
else
Wt = S0g*Cv*b*pi*m*yg;
Ws = Seg*b*pi*m*yg;
end
P = Wt*v;
else
P = input ('Enter the value of Power(P)\n');
Wt = P/v;
if (S0p*yp <= S0g*yg)
Ws = Sep*b*pi*m*yp;
else
Ws = Seg*b*pi*m*yg;
end
end
Pd = 1/m;
Pc = pi*m;
K = 0.111;
if (m==4*10^(-3))
e = 0.0125*10^(-3);
elseif (m==5*10^(-3))
e = 0.015*10^(-3);
elseif (m==6*10^(-3))
e = 0.017*10^(-3);
elseif (m==7*10^(-3))
e = 0.0186*10^(-3);
elseif (m==8*10^(-3))
e = 0.0198*10^(-3);
elseif (m==10*10^(-3))
e = 0.023*10^(-3);
elseif (m==12*10^(-3))
e = 0.0243*10^(-3);
elseif (m==16*10^(-3))
e = 0.03*10^(-3);
elseif (m==20*10^(-3))
e = 0.033*10^(-3);
end
% e=0.033*10^(-3)
C = K.*e/(1/Ep + 1/Eg);
Wd = Wt + (21*v*(b*C + Wt))/(21*v +((b*C + Wt)^.5));
if (Ws <= Wd)
fprintf('TOOTH BREAKAGE OCCURS\n');
end
b1 = b;
Dg1= Dg;
Dp1 = Dp;
G1 = G;
L1= L;
m1 = m;
Ng1 = Ng;
Np1 = Np;
P1 = P;
Pc1 = Pc;
Pd1 = Pd;
phi1 = phi;
Tg1 = Tg;
Tp1 = Tp;
v1 = v;
Wd1 = Wd;
Ws1 = Ws;
Wt1 = Wt;
%The parameters of gear
n=Tg/5; %The number of teeth
n= ceil(n);
pd=Pd/39.37; %The diametral pitch
phi_d=phi; %The pressure angle in degrees
% ----------------------------------------------------------------------------
r_fillet=0.05; %The radius of fillet
% ----------------------------------------------------------------------------
%To declare variables
xp=zeros(10,1);yp=zeros(10,1);
xo=zeros(5,1);yo=zeros(5,1);
xr=zeros(3,1);yr=zeros(3,1);
xro=zeros(5,1);yro=zeros(5,1);
xf=zeros(5,1);yf=zeros(5,1);
theta=zeros(10,1);
f=zeros(2,28);
M=[];c=[];e=[];g=[];h=[];
% ----------------------------------------------------------------------------
%To calculate the basic parameters of a gear
d=n/pd; %pitch diamter
phi=phi_d*pi/180; %pressure angle in radians
db=d*cos(phi); %diameter of base circle
do=d+2/pd; %addendum (outside) diameter
tt=pi/(2*pd); %tooth thickness at the pitch circle
dr=d-2*1.25/pd; %dedendum (root) diameter
% ----------------------------------------------------------------------------
%To calculate the coordinates of the involute profile
n1=10;
tp=pi*d/(2*n);
for i=1:n1
r=do/2-(do-db)*(i-1)/(2*(n1-1));
pha=acos(db/(2*r));
t=2*r*(tp/d+(tan(phi)-phi)-(tan(pha)-pha)); %tooth tickness at any angle phi
theta(i)=t/(2*r);
xp(i)=r*sin(theta(i)); %change from polar coordinates to cartesian coordinates
yp(i)=r*cos(theta(i));
end
xp=xp';yp=yp';
% ----------------------------------------------------------------------------
%To calculate the addendum circle
n2=5;
for i=1:n2
theta_o=theta(1)*(i-1)/(n2-1);
xo(i)=(do/2)*sin(theta_o);
yo(i)=(do/2)*cos(theta_o);
end
xo=xo';yo=yo';
% ----------------------------------------------------------------------------
for i=1:3
theta0=asin((xp(1,n1)+r_fillet)/(dr/2));
%to find the angle between the central line (y-axis) and the line from the center
xr(i)=xp(1,10);
yr(i)=yp(1,10)-(yp(1,10)-r_fillet-(dr/2)*cos(theta0))*i/3;
end
xr=xr';yr=yr';
% ----------------------------------------------------------------------------
%To calculate the dedendum circle
n3=5;
for i=1:n3
thetar=theta0+(pi/n-theta0)*(i-1)/(n3-1);
%(pi/n-theta0) angle subtended for dededem arc
xro(i)=dr*sin(thetar)/2;
yro(i)=dr*cos(thetar)/2;
end
xro=xro';yro=yro';
% ----------------------------------------------------------------------------
%To calculate fillet
n4=5;
for i=1:n4
xf(i)=xro(1)-r_fillet*cos((i-1)*pi/(2*n4-2));
yf(i)=yro(1)+r_fillet*(1-sin((i-1)*pi/(2*n4-2))); %yf(5)=yro(1)-r_fillet*sin(4*pi/8)
end
xf=xf';yf=yf';
% ---------------------------------------------------------------------------
%To append each piece of curve to generate one-half of a tooth profile
c=[c,xo,xp,xr,xf,xro];
e=[e,yo,yp,yr,yf,yro];
g=[c',e'];
g=g'; %the one-half tooth profile
% ----------------------------------------------------------------------------
%To reflecte the involute curve about y axis to get the whole tooth
ff=[-1 0;0 1]*g; %reflection
n5=n1+n2+n3+n4+3;
for i=1:n5 %n4 points =n1(involute)+n2(addendum)+n4(fillet)
% +3(noninvolute)+n3(dedendum)
f(1,i)=ff(1,n5+1-i); %reverse the order of the points, easy for plotting
f(2,i)=ff(2,n5+1-i);
end
h=[h,f,g]; %the whole tooth profile
% ----------------------------------------------------------------------------
%To rotate and append the tooth to generate the gear
plot (g(1,:),g(2,:),'b',xp,yp,'b', 'linewidth',4)
for i=1:n
kk=[cos(2*pi*(i-1)/n) sin(2*pi*(i-1)/n);-sin(2*pi*(i-1)/n) cos(2*pi*(i-1)/n)];
%rotation matrix
mm=kk*h; %rotate
M=[M,mm]; %append
end
M=[M,h(:,1)]; %add the first point, so the curve returns to the original point
% ----------------------------------------------------------------------------
plot (g(1,:),g(2,:),'b', 'linewidth',4) %plot one-half tooth
plot (h(1,:),h(2,:), 'b','linewidth',4) %xplot one tooth
plot (M(1,:),M(2,:),'b', 'linewidth',4) %plot the whole gear - the first row (x) and second row (y)
hold on
% plot (g(1,:),g(2,:),'b',xp,yp,'b', 'linewidth',4) %plot one-half tooth, the involute curve part is red
% axis('equal')
% hold on
% plot (g(1,:),g(2,:),g(1,:),g(2,:),'b',xp,yp, 'linewidth',4)
% axis('equal')
% hold on
% plot (g(1,:),g(2,:),xp,yp, 'linewidth',4)
% axis('equal')
legend(['Pd1=' num2str(Pd1)], ['m1=' num2str(m1)], ['G1=' num2str(G1)]);
M=M'; %transpose the matrix to get only two columns,
clear c d db do dr f ff g h i kk M mm n n1 n2 n3 n4 n5 pd pha phi_d r r_fillet
clear xf xo xp xro yf xr yro yo yr t theta theta0 theta_o thetar tp tt
clear C CI Curvature Cv e gear K N PB pinion S S0g S0p Seg Sep SS Y yg yp Eg Ep
clear b Dg Dp G L m Ng Np P Pc Pd phi Tg Tp v Wd Ws Wt
Take inputs as: Pressure angle-20, Gear Ratio-2, Centre distance-0.6, Pinion Speed-200,Tp-Y and 50,Pinion Material-1, Gear Material-2, Face width- N, Power- Y and 22500
0 Comments
Answers (0)
See Also
Categories
Find more on Assembly in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!