本站消息

站长简介/公众号

  出租广告位,需要合作请联系站长

+关注
已关注

分类  

暂无分类

标签  

暂无标签

日期归档  

2024-11(1)

【气动学】基于matlab气动力导弹姿态控制【含Matlab源码 969期】

发布于2021-06-07 20:18     阅读(604)     评论(0)     点赞(5)     收藏(5)


一、简介

基于matlab气动力导弹姿态控制

二、源代码

clc;clear;
%------------------------定义导弹、大气、地球等固定参数---------------------%
Jx=2.95;Jy=168.2;Jz=168.2;
m=300;S=0.0616;L=0.3;
rho=1.2;g=9.8;
i=10000;
ii=i/10;
t=zeros(1,ii-1);dt=0.001;
H=pi/180;K=180/pi;
%-------------------------定义初始位置参数---------------------------------%
x=zeros(1,i);y=zeros(1,i);z=zeros(1,i);
y(1)=30000;
%-------------------------定义初始速度参数---------------------------------%
V=zeros(1,i);Vx=zeros(1,i);Vy=zeros(1,i);Vz=zeros(1,i);
V(1)=2275;Vx(1)=2275;
%-------------------------定义初始弹道参数---------------------------------%
theta=zeros(1,i);psiv=zeros(1,i);gammav=zeros(1,i);
theta(1)=(40*pi)/180;
%-------------------------定义初始姿态参数---------------------------------%
htheta=zeros(1,i);psi=zeros(1,i);gamma=zeros(1,i);
htheta(1)=40*H;psi(1)=0*H;gamma(1)=5*H;
htheta0=50*H;psi0=10*H;gamma0=0*H;
%---------------------------定义初始舵偏角---------------------------------%
deltax=zeros(1,i);deltay=zeros(1,i);deltaz=zeros(1,i);
%--------------------------定义初始姿态角速度参数---------------------------%
omegax=zeros(1,i);omegay=zeros(1,i);omegaz=zeros(1,i);
%-------------------------定义攻角/侧滑角----------------------------------%
alpha=zeros(1,i);beta=zeros(1,i);dalpha=0;dbeta=0;
%--------------------定义空气动力和空气动力矩-------------------------------%
X=zeros(1,i);Y=zeros(1,i);Z=zeros(1,i);
Mx=zeros(1,i);My=zeros(1,i);Mz=zeros(1,i);
%--------------------------定义控制律参数----------------------------------%
Kpx=-1.5;   Kdx=-0.018;
Kpy=-1.5;   Kdy=-0.05;
Kpz=-1.8;   Kdz=-0.05;
%--------------------------------定义绘图用数组----------------------------%
hthetat=zeros(1,ii-1);psit=zeros(1,ii-1);gammat=zeros(1,ii-1);
omegaxt=zeros(1,ii-1);omegayt=zeros(1,ii-1);omegazt=zeros(1,ii-1);
xt=zeros(1,ii-1);yt=zeros(1,ii-1);zt=zeros(1,ii-1);
Mxt=zeros(1,ii-1);Myt=zeros(1,ii-1);Mzt=zeros(1,ii-1);
deltaxt=zeros(1,ii-1);deltayt=zeros(1,ii-1);deltazt=zeros(1,ii-1);
%------------------------定义气动力、气动力矩的插值矩阵---------------------%
B = [-6,-4,-2,0,2,4,6];
A = [-6;-4;-2;0;2;3;4;6;8;10];

CX = [0.926,0.750,0.636,0.583,0.614,0.722,0.888;0.758,0.596,0.511,0.468,0.489,0.570,0.726;
      0.644,0.504,0.426,0.398,0.411,0.487,0.614;0.602,0.477,0.399,0.367,0.390,0.458,0.574;
      0.650,0.508,0.428,0.410,0.415,0.502,0.627;0.699,0.547,0.463,0.434,0.449,0.533,0.674;
      0.762,0.601,0.512,0.471,0.497,0.585,0.739;0.921,0.749,0.628,0.578,0.613,0.735,0.902;
      1.136,0.949,0.817,0.763,0.800,0.934,1.115;1.405,1.212,1.080,1.029,1.067,1.200,1.388];

CY = [-2.694,-2.563,-2.426,-2.351,-2.427,-2.605,-2.686;-1.854,-1.710,-1.642,-1.593,-1.618,-1.711,-1.800;
      -0.920,-0.818,-0.802,-0.794,-0.797,-0.798,-0.873;0.034,0.036,0.015,0.033,0.009,0.004,0.031;
      0.930,0.894,0.868,0.808,0.802,0.836,0.928;1.373,1.331,1.275,1.190,1.233,1.257,1.340;
      1.825,1.751,1.685,1.566,1.633,1.715,1.787;2.704,2.647,2.460,2.344,2.428,2.583,2.677;
      3.411,3.458,3.365,3.276,3.312,3.397,3.392;4.175,4.292,4.283,4.241,4.218,4.263,4.181];

CZ = [2.703,1.833,0.932,0,-0.932,-1.833,-2.703;2.619,1.753,0.880,0,-0.880,-1.753,-2.619;
      2.479,1.634,0.846,0,-0.846,-1.634,-2.479;2.447,1.620,0.806,0,-0.806,-1.620,-2.447;
      2.513,1.670,0.816,0,-0.816,-1.670,-2.513;2.582,1.693,0.829,0,-0.829,-1.693,-2.582;
      2.637,1.719,0.845,0,-0.845,-1.719,-2.637;2.717,1.823,0.931,0,-0.931,-1.823,-2.717;
      2.700,1.930,1.000,0,-1.000,-1.930,-2.700;2.775,1.999,1.027,0,-1.027,-1.999,-2.775];

MX = [-0.035,-0.008,0.030,0,-0.030,0.008,0.035;0.027,0.006,0.020,0,-0.020,-0.006,-0.027;
      0.021,0.060,0.008,0,-0.008,-0.060,-0.021;0.000,0.000,0.000,0,0.000,0.000,0.000;
      -0.017,-0.034,-0.002,0,0.002,0.034,0.017;-0.032,-0.047,0.001,0,-0.001,0.047,0.032;
      -0.034,-0.012,0.037,0,-0.037,0.012,0.034;0.014,0.028,0.038,0,-0.038,-0.028,-0.014;
      0.022,0.095,0.025,0,-0.025,-0.095,-0.022;0.007,0.195,0.098,0,-0.098,-0.195,-0.007];

MY = [2.096,1.498,0.750,0,-0.750,-1.498,-2.096;1.893,1.314,0.671,0,-0.671,-1.314,-1.893;
      1.658,1.126,0.612,0,-0.612,-1.126,-1.658;1.612,1.138,0.530,0,-0.530,-1.138,-1.612;
      1.763,1.224,0.564,0,-0.564,-1.224,-1.763;1.873,1.223,0.545,0,-0.545,-1.223,-1.873;
      2.010,1.291,0.612,0,-0.612,-1.291,-2.010;2.257,1.549,0.810,0,-0.810,-1.549,-2.257;
      2.398,1.838,0.988,0,-0.988,-1.838,-2.398;2.729,2.137,1.126,0,-1.126,-2.137,-2.729];

MZ = [2.320,2.042,1.857,1.738,1.848,2.083,2.243;1.617,1.287,1.216,1.243,1.192,1.260,1.456;
      0.732,0.501,0.527,0.566,0.519,0.455,0.616;-0.164,-0.181,-0.141,-0.147,-0.132,-0.130,-0.182;
      -0.964,-0.898,-0.840,-0.751,-0.729,-0.787,-0.956;-1.366,-1.303,-1.186,-1.050,-1.094,-1.166,-1.322;
      -1.763,-1.647,-1.525,-1.334,-1.422,-1.579,-1.713;-2.525,-2.469,-2.077,-1.881,-2.011,-2.349,-2.498;
      -3.078,-3.052,-2.793,-2.608,-2.734,-2.994,-3.040;-3.690,-3.709,-3.563,-3.438,-3.493,-3.692,-3.699];

 %---------------------------------循环计算--------------------------------%
    for n=1:i-1
      %-------------------------------控制律-------------------------------% 
       if mod(n,10)==0
           
           ux = Kpx*(gamma0-gamma(n))*K+Kdx*(-omegax(n))*K;
           uy = Kpy*(psi0-psi(n))*K+Kdy*(-omegay(n))*K;
           uz = Kpz*(htheta0-htheta(n))*K+Kdz*(-omegaz(n))*K;
           
           if (ux>(15))
               ux = 15;
           end
           if (ux<(-15))
               ux = -15;
           end
           if (uy>(15))
               uy = 15;
           end
           if (uy<(-15))
               uy = -15;
           end
           if (uz>(15))
               uz = 15;
           end
           if (uz<(-15))
               uz = -15;
           end
          %------------------------判断并计算舵偏角------------------------%
           if (abs(gamma(n)-gamma0)>(0.1*H) || (abs(omegax(n))>(0.5*H)))
               deltax(n:n+10) = ux;
           else
               deltax(n:n+10) = 0;
           end
           if deltax(n)==0&(abs(psi(n)-psi0)>(0.1*H) || (abs(omegay(n))>(0.5*H)))
               deltay(n:n+10) = uy;
           else
               deltay(n:n+10) = 0;
           end
           if deltax(n)==0&deltay(n)==0&(abs(htheta(n)-htheta0)>(0.1*H) || (abs(omegaz(n))>(0.5*H)))
               deltaz(n:n+10) = uz;
           else
               deltaz(n:n+10) = 0;
           end
       end
          %------------------------------------------------------------------%
        q=0.5*rho*(V(n)^2);
        
        cx0 = interp2(B,A,CX,beta(n)*K,alpha(n)*K);
        cy0 = interp2(B,A,CY,beta(n)*K,alpha(n)*K);
        cz0 = interp2(B,A,CZ,beta(n)*K,alpha(n)*K);       
        
        mx0 = interp2(B,A,MX,beta(n)*K,alpha(n)*K);
        my0 = interp2(B,A,MY,beta(n)*K,alpha(n)*K);
        mz0 = interp2(B,A,MZ,beta(n)*K,alpha(n)*K);       
        
        omegax1 = omegax(n)*K*L/V(n);
        omegay1 = omegay(n)*K*L/V(n);
        omegaz1 = omegaz(n)*K*L/V(n);
        
        cx = cx0+0.001*(deltax(n)+deltay(n)+deltaz(n));
        cy = cy0+0.06*deltaz(n);
        cz = cz0-0.06*deltay(n);
        
        mx = mx0-0.0340*deltax(n)-11.17*omegax1-1.2650*omegay1;
        my = my0-0.2931*deltay(n)-195.5*omegay1+0.7921*omegax1;
        mz = mz0-0.2931*deltaz(n)-195.5*omegaz1-70.8*dalpha*K*L/V(n);
        
        X(n) = cx*q*S;
        Y(n) = cy*q*S;
        Z(n) = cz*q*S;
        
        Mx(n) = mx*q*S*L;
        My(n) = my*q*S*L;
        Mz(n) = mz*q*S*L;
     %---------------------飞行力学方程组求解-----------------%  
        %---------------------飞行器受力方程组------------%
        Fx = -X(n)*cos(beta(n))*cos(alpha(n))+Y(n)*sin(alpha(n))-Z(n)*sin(beta(n))-m*g*sin(htheta(n));
        Fy = X(n)*cos(beta(n))*sin(alpha(n))+Y(n)*cos(alpha(n))-m*g*cos(theta(n))*cos(gamma(n));
        Fz = -X(n)*sin(beta(n))+Z(n)*cos(beta(n))+m*g*cos(htheta(n))*sin(gamma(n));
        %---------------------飞行器速度方程组------------%
        dVx = Fx/m-omegay(n)*Vz(n)+omegaz(n)*Vy(n);
        dVy = Fy/m-omegaz(n)*Vx(n)+omegax(n)*Vz(n);
        dVz = Fz/m-omegax(n)*Vy(n)+omegay(n)*Vx(n);
        
        Vx(n+1) = Vx(n)+dVx*dt;
        Vy(n+1) = Vy(n)+dVy*dt;
        Vz(n+1) = Vz(n)+dVz*dt;

三、运行结果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

四、备注

版本:2014a

原文链接:https://blog.csdn.net/TIQCmatlab/article/details/117629266



所属网站分类: 技术文章 > 博客

作者:再拍我就焖面

链接:http://www.phpheidong.com/blog/article/89514/5c5649b3673a53e533f7/

来源:php黑洞网

任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任

5 0
收藏该文
已收藏

评论内容:(最多支持255个字符)