齿轮范成程序MATLAB代码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

本人经过一个月的努力,写出了以下齿轮展成程序,是matlab格式的。只要按照附图的标注定义出滚刀刀齿的形状,指定程序模拟的精度,就可以模拟出滚刀滚切齿轮的图形.下图为程序中定义刀具的尺寸示意图以下为源程序%shapeofhob%inputareacls;alpha=deg2rad(21);%压力角alphaf=deg2rad(31);%齿顶倒角压力角W0=1.85;%节圆半齿宽H=6;%全齿高ha0=3;%齿顶高hf0=1.44;%齿根倒角起点高度H1=0.064;%触角厚度hc=1.3;%触角高度ht=0.65;%触角凸部的高度rc=0.6;%齿顶圆角半径R=30;%工件分度圆半径P=7.54;%刀具齿距N=2;%刀齿数amount=10;%每段线上取点的个数step=100;%计算步数range=[-pi*0.15,pi*0.15];%计算范围%locationofkey-pointyr=ha0-rc;%齿顶圆角圆心xr=W0+(H1-rc)/cos(alpha)-yr*tan(alpha);point=zeros(6,2);point(1,2)=ha0;point(1,1)=xr;point(2,2)=ha0-rc*(1-sin(alpha));point(2,1)=xr+rc*cos(alpha);point(3,2)=ha0-ht;point(3,1)=(W0+H1/cos(alpha))-(ha0-ht)./cot(alpha);point(4,2)=ha0-hc;point(4,1)=W0-point(4,2)*tan(alpha);point(5,2)=-hf0;point(5,1)=W0-tan(alpha)*point(5,2);point(6,2)=ha0-H;point(6,1)=point(5,1)-tan(alphaf)*(point(6,2)-point(5,2));%-------------直线部分-------------theta=linspace(range(1),range(2),step);w11=linspace(point(4,1),point(5,1),amount)';h11=linspace(point(4,2),point(5,2),amount)';w12=repmat(w11,1,step);h12=repmat(h11,1,step);theta2=repmat(theta,amount,1);x12=(h12-R).*sin(theta2)+(R.*theta2-w12).*cos(theta2);y12=(R.*theta2-w12).*sin(theta2)+(R-h12).*cos(theta2);theta13=(w11-h11/tan(alpha))/R;x13=sin(theta13).*(h11-R)+cos(theta13).*(R.*theta13-w11);y13=sin(theta13).*(R*theta13-w11)+cos(theta13).*(R-h11);%-----------圆角部分--------gama=linspace(pi/2,alpha,amount);w21=(xr+rc.*cos(gama))';h21=(yr+rc.*sin(gama))';w22=repmat(w21,1,step);h22=repmat(h21,1,step);x22=(h22-R).*sin(theta2)+(R.*theta2-w22).*cos(theta2);y22=(R.*theta2-w22).*sin(theta2)+(R-h22).*cos(theta2);theta23=((xr-yr.*cot(gama))/R)';x23=sin(theta23).*(h21-R)+cos(theta23).*(R.*theta23-w21);y23=sin(theta23).*(R*theta23-w21)+cos(theta23).*(R-h21);rmin=R;fori=1:(length(x23)-2)[XX,YY,RR]=threepointcircle(x23(i),y23(i),x23(i+1),y23(i+1),x23(i+2),y23(i+2));ifRRrminrmin=RR;endend%---------凸角部分------------------w31=linspace(point(2,1),point(3,1),amount)';h31=linspace(point(2,2),point(3,2),amount)';w32=repmat(w31,1,step);h32=repmat(h31,1,step);theta2=repmat(theta,amount,1);x32=(h32-R).*sin(theta2)+(R.*theta2-w32).*cos(theta2);y32=(R.*theta2-w32).*sin(theta2)+(R-h32).*cos(theta2);theta33=(w31-h31/tan(alpha))/R;x33=sin(theta33).*(h31-R)+cos(theta33).*(R.*theta33-w31);y33=sin(theta33).*(R*theta33-w31)+cos(theta33).*(R-h31);%-------连接部分---------------alpha2=atan(point(4,1)-point(3,1))/(point(3,2)-point(4,2));w41=linspace(point(3,1),point(4,1),amount)';h41=linspace(point(3,2),point(4,2),amount)';w42=repmat(w41,1,step);h42=repmat(h41,1,step);theta2=repmat(theta,amount,1);x42=(h42-R).*sin(theta2)+(R.*theta2-w42).*cos(theta2);y42=(R.*theta2-w42).*sin(theta2)+(R-h42).*cos(theta2);theta43=(w41-h41/tan(alpha2))/R;x43=sin(theta43).*(h41-R)+cos(theta43).*(R.*theta43-w41);y43=sin(theta43).*(R*theta43-w41)+cos(theta43).*(R-h41);%-------倒角部分---------------alpha3=atan(point(6,1)-point(5,1))/(point(5,2)-point(6,2));w51=linspace(point(5,1),point(6,1),amount)';h51=linspace(point(5,2),point(6,2),amount)';w52=repmat(w51,1,step);h52=repmat(h51,1,step);theta2=repmat(theta,amount,1);x52=(h52-R).*sin(theta2)+(R.*theta2-w52).*cos(theta2);y52=(R.*theta2-w52).*sin(theta2)+(R-h52).*cos(theta2);theta53=(w51-h51/tan(alpha3))/R;x53=sin(theta53).*(h51-R)+cos(theta53).*(R.*theta53-w51);y53=sin(theta53).*(R*theta53-w51)+cos(theta53).*(R-h51);%----------全刀齿-----------w6=[w21;w31;w41;w11;w51];h6=[h21;h31;h41;h11;h51];w6=flipud(w6);h6=flipud(h6);w6=[w6;-flipud(w6)];h6=[h6;flipud(h6)];w62=w6;h62=h6;fori=2:Nw62=[w6+(i-1)*P;w62];h62=[h6;h62];endtheta6=repmat(theta,5*amount*2*N,1);w62=repmat(w62,1,step);h62=repmat(h62,1,step);x62=(h62-R).*sin(theta6)+(R.*theta6-w62).*cos(theta6);y62=(R.*theta6-w62).*sin(theta6)+(R-h62).*cos(theta6);%---------------------figure;plot(x12,y12);holdon;gridon;axisequal;plot(x22,y22);plot(x32,y32);plot(x42,y42);plot(x52,y52);figure;plot(x12',y12');holdon;gridon;axisequal;plot(x22',y22');plot(x32',y32');plot(x42',y42');plot(x52',y52');figure;plot(x13,y13);holdon;gridon;axisequal;plot(x23,y23,'o');plot(x33,y33,'*');plot(x43,y43,'.');plot(x53,y53,'+');figureplot(x12',y12');holdon;gridon;axisequal;plot(x22',y22');plot(x32',y32');plot(x42',y42');plot(x52',y52');plot(x13,y13,'*');plot(x23,y23,'*');plot(x33,y33,'*');plot(x43,y43,'*');plot(x53,y53,'*');figureplot(w62,h62);holdon;gridon;axisequal;figureplot(x62,y62);holdon;gridon;axisequal;以下为角度转化为弧度的子程序functionrad=deg2rad(deg)rad=deg./180.*pi;以下为计算最小圆弧半径的子程序function[x,y,r]=threepointcircle(x1,y1,x2,y2,x3,y3)k12=(x2-x1)/(y1-y2);k23=(x3-x2)/(y2-y3);x=((y2+y3-y1-y2)/2+k12*(x1+x2)/2-k23*(x2+x3)/2)/(k12-k23);y=k12*(x-(x1+x2)/2)+(y1+y2)/2;r=((x-x1)^2+(y-y1)^2)^0.5;以下为程序运行输出的图形1,一个刀刃的展成过程2,一个刀刃上各个点的运动轨迹3,刀刃上各段切削刃分别所展成的齿形段4,两图合二为一5,刀齿的形状6,多个刀齿展成的情形7,将6图放大观察,也许是渐开线起始点的位置吧以上就是程序代码及输出的结果欢迎批评指正分享经验,交流心得,共同进步有意交流的+Q252320995并说明来意李某人2013/6/30于重庆璧山

1 / 8
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功