机械设计课程设计报告-荧光灯灯丝装架机上料机械手及芯柱传送机构设计 第4页

    x1=x11;

    x2=x22;

end

 

function [y1,y2]=maxtanaII(e,s0)

%y1,y2 is the Max forward and backward press angle

%e, s0 see the Textbook P145

usalconst;  %Load usual constant

st=5*deg;       %搜索步长

phi=0;

y1=0;           %储存推程最大压力角

y2=0;           %存回程最大压力角

while(phi<=2*pi)    %粗取最大压力角的范围

    t=tanaII(phi,e,s0);

    if dsphiII(phi)>=0;    %判断是推程还是回程

        if(t>=y1)   

            y1=t;

            x1=phi;%储存推程最大压力角位置

        end

    else

        if(t>y2)

            y2=t;

            x2=phi;%储存回程最大压力角位置

        end

    end

    phi=phi+st;

end

x11=x1;

x22=x2;

while(st>0.01*deg)      %精搜索

    range=st;

    phi=-1*st;

    st=st*0.1; %精搜索步长

    while(phi<range)     

        phi=phi+st;

        if(phi+x1<2*pi&phi+x1>=0)

            t1=tanaII(phi+x1,e,s0);

        end

        t2=tanaII(phi+x2,e,s0);

        if (t1>y1)&(dsphiII(phi+x1)>0)

            y1=t1;

            x11=phi+x1;    %精搜索最值位置

        end

        if  (t2>y2)

            y2=t2;

            x22=phi+x2;    %精搜索最值位置

        end

    end

    x1=x11;

    x2=x22;

end

       

function y = sphiI(x)

%sbyphi means s by phi x is the angle of radian unit

%this function returns the value of s(/phi) in the mission

usalconst;          %load usual constant

if (x<0)|(x>2*pi)

    error('Input Range error(0~2*pi)');

else

    h=30;                   %从动件行程

    if x<(72*deg)&(x>=0)

        y=0.5*h*(1+sin(15/8*(x-24*deg)));

    else

        if(x>=72*deg)&(x<216*deg)

            y=h;

        else

            if(x>=216*deg)&(x<312*deg)

                y=0.5*h*(1+cos((x-216*deg)*15/8));

            else

                if x>=312*deg&x<336*deg

                    y=0;

                else

                    y=0.5*h*(1+sin(15/8*x));

                end                   

            end

        end

    end

end

上一页  [1] [2] [3] [4] [5] [6] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有