📄 gear_curve.asv
字号:
% gear
% unit: mm
% press ang: 20deg
clear;
m=2;
z=50;
h=.5;% 1*m
rb=.5*m*z*cos(20*pi/180);
ra=m*(.5*z+h);
N=100;
delr=(ra-rb)/N;
% cal one side
rk=rb:delr:ra;
alphak=acos(rb./rk);
thetak=tan(alphak)-alphak;
% circle
for n=1:361
xc(n)=rb*cos(n*pi/180);
yc(n)=rb*sin(n*pi/180);
end
plot(xc,yc);
hold on;
axis equal
%axis square
% plot one side
for n=0:z-1
x=rk.*cos(n*360/z*pi/180+thetak);
y=rk.*sin(n*360/z*pi/180+thetak);
plot(x,y,'r');
end
% cal ang at contact point of one side
rc=.5*m*z;
alphac=acos(rb/rc);
thetac=tan(alphac)-alphac;
theta_width=2*pi/z/2;
theta_otherside=thetac*2+theta_width;
% cal other side
rk2=rb:delr:ra;
alphak2=-acos(rb./rk); % negative
thetak2=tan(alphak2)-alphak2;
% plot other side
for n=0:z-1
x=rk2.*cos(n*360/z*pi/180+theta_otherside+thetak2);
y=rk2.*sin(n*360/z*pi/180+theta_otherside+thetak2);
plot(x,y,'r');
end
% close the gear
i=1;
for n=linspace(max(thetak),theta_otherside+min(thetak2),10)
xg(i)=ra*cos(n);
yg(i)=ra*sin(n);
i=i+1;
end
clear x
clear y
for n=0:z-1
x=xg*cos(n*360/z*pi/180)-yg*sin(n*360/z*pi/180);
y=xg*sin(n*360/z*pi/180)+yg*cos(n*360/z*pi/180);
plot(x,y,'r');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -