带落角约束(变结构和比例)源代码

来源:互联网 发布:淘宝抢红包在哪 编辑:程序博客网 时间:2024/05/01 04:47
1、变结构制导律和比例导引均集成在同一个程序中,其表达式分别见daoyin.m第48行和53行;如果不需要某个导引律,请将其注释(前面加“%”)。2、比例导引和变结构导引结果图可以画在同一幅图中(每运行完一种导引律后,不要关闭图,继续运行下一种导引律)。clearclc%-----------导弹参数---------V_m=300;X_m=0;Y_m=3000;theta_m=0*pi/180;%----------目标参数---------V_t=0; %静止目标X_t=3000;Y_t=0;theta_t=0;dtheta_t=0;n_t=0;A_t=0;%变结构制导律参数设置k=1;delta=0.01;epu=.9;lam=1.5;%比例导引律参数设置N1=20; %纵向通道导引系数R=sqrt((X_m-X_t)^2+(Y_m-Y_t)^2);q=atan((Y_t-Y_m)/(X_t-X_m));dR=((X_m-X_t)*(V_m*cos(theta_m)-V_t*cos(theta_t))+(Y_m-Y_t)*(V_m*sin(theta_m)-V_t*sin(theta_t)))/sqrt((X_m-X_t)^2+(Y_m-Y_t)^2);dq=((X_t-X_m)*(V_t*sin(theta_t)-V_m*sin(theta_m))-(Y_t-Y_m)*(V_t*cos(theta_t)-V_m*cos(theta_m)))/((X_m-X_t)^2+(Y_m-Y_t)^2);n_m=-q+theta_m;n=1;t=0;dt=0.01;g=9.8;hit_angle=-90*pi/180;  %期望命中角度while (dR<0)    %--------变结构导引律    %见论文《一种变结构垂直俯冲攻击制导律》    x1=q-hit_angle;    x2=dq;    S=x2+lam*V_m*x1/R;    fun=S/(abs(S)+delta);    %Am=(-k*abs(dR)*S-epu*S/(abs(S)+delta)+2*dR*x2-cos(q-theta_t)*A_t-lam*V_m*x2+lam*V_m*x1*dR/R)/(-cos(q-theta_m));  %改进的变结构导引律    %-----------Zarchan弹道成型比例导引律%见论文《几种增大空地导弹落角的制导方式比较》1.2节    t_go=R/abs(dR);    Am=10*dq*abs(dR)+10*abs(dR)*(q-hit_angle)/t_go+g*cos(theta_m); %Zarchan弹道成型比例导引律            %----------------------------计算坐标---------------------------      dtheta_m=Am/V_m;     theta_m=theta_m+dtheta_m*dt;    X_m=X_m+V_m*cos(theta_m)*dt;    Y_m=Y_m+V_m*sin(theta_m)*dt;        n_m=-q+theta_m;     R=sqrt((X_m-X_t)^2+(Y_m-Y_t)^2);    q=atan((Y_t-Y_m)/(X_t-X_m));    dR=((X_m-X_t)*(V_m*cos(theta_m)-V_t*cos(theta_t))+(Y_m-Y_t)*(V_m*sin(theta_m)-V_t*sin(theta_t)))/sqrt((X_m-X_t)^2+(Y_m-Y_t)^2);    dq=((X_t-X_m)*(V_t*sin(theta_t)-V_m*sin(theta_m))-(Y_t-Y_m)*(V_t*cos(theta_t)-V_m*cos(theta_m)))/((X_m-X_t)^2+(Y_m-Y_t)^2);            theta_m_store(n)=theta_m;  %保存弹道倾角     Am_store(n)=Am;   %保存纵向过载    P_m_store(:,n)=[X_m;Y_m]; %保存拦截弹坐标    fun_s(n)=fun; %保存线性化函数    n=n+1;    t=t+dt;enddisp('脱靶量为(m):')Rdisp('飞行时间为(s):')tdisp('落角偏差为(°):')90+q*180/pifigure(1)plot(P_m_store(1,:),P_m_store(2,:),X_t,Y_t,'r+')hold onxlabel('X/m')ylabel('Y/m')hold ongrid onfigure(2)plot((1:n-1)*dt,Am_store)hold onxlabel('time/s')ylabel('Acceleration/m^2')title('加速度')hold ongrid onfigure(3)plot((1:n-1)*dt,theta_m_store*180/pi)hold onxlabel('time/s')ylabel('\theta_m/°')title('弹道倾角')hold ongrid on

0 0