• 大小: 1KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-07
  • 语言: Matlab
  • 标签: Matlab  

资源简介

平面内的导弹制导律模拟程序,用Matlab写的,方便理解导弹制导的简单概念

资源截图

代码片段和文件信息

clear;
dt=0.001;% time step
g=9.80665;% acceleration of gravity
n=zeros(3100);% vertical overload

%% method of three-points
% angle between velocity and station-missile-target line
sigma_m=zeros(1100);sigma_m(1)=pi/6;
sigma_t=pi;
% velocity
v_m=1000;
v_t=500;
% distance to station
r_m=zeros(1100);
r_t=zeros(1100);r_t(1)=10000;
% angel between the station-missile-target line and the level
q=zeros(1100);q(1)=pi/6;

coor_m=zeros(2100);% coordinate of missile
coor_m(11)=r_m(1)*cos(q(1));
coor_m(21)=r_m(1)*sin(q(1));
coor_t=zeros(2100);% coordinate of target
coor_t(11)=r_t(1)*cos(q(1));
coor_t(21)=r_t(1)*sin(q(1));
t=1;
while abs(r_m(t)-r_t(t))>1e-1
    r_m(t+1)=v_m*cos(sigma_m(t)-q(t))*dt+r_m(t);
    r_t(t+1)=v_t*cos(sigma_t-q(t))*dt+r_t(t);
    q(t+1)=v_t/r_t(t)*sin(sigma_t-q(t))*dt+q(t);
    sigma_m(t+1)=asin((v_t*r_m)/(v_m*r_t)*sin(sigma_t-q(t+1)))+q(t+1);
    
    % calculate the coordinate and vertical overload
    n(1t)=v_m*(sigma_m(t+1)-sigma_m(t))/g;
    t=t+1;
    coor_m(1t)=r_m(t)*cos(q(t));
    coor_m(2t)=r_m(t)*sin(q(t));
    coor_t(1t)=r_t(t)*cos(q(t));
    coor_t(2t)=r_t(t)*sin(q(t));
end
figure(1);
subplot(211);
plot(coor_m(1:)coor_m(2:)...
    ‘Color‘‘blue‘);%locus of missile
hold on;
plot(coor_t(1:)coor_t(2:)...
    ‘Color‘‘red‘);% locus of target
title(‘三点法轨迹‘);
subplot(212);
plot(n(1:));
title(‘法向过载‘);

%% tracking method
clear q sigma_m r_m r_t;
% angel between missile-target line and the level
q=zeros(1100);q(1)=pi/6;
sigma_m=zeros(1100);sigma_m(1)=pi/6;
% distance between the target and missile
r=zeros(1100);r(1)=10000;
r_m=zeros(1100);
r_t=zeros(1100);r_t(1)=10000;
% angle between r_m/r_t and the level
q_m=zeros(1100);q_m(1)=pi/6;
q_t=zeros(1100);q_t(1)=pi/6;

clear coor_m;
coor_m=zeros(2100);
coor_m(11)=r_m(1)*cos(q_m(1));
coor_m(21)=r_m(1)*sin(q_m(1));
clear coor_t;
coor_t=zeros(2100);
coor_t(11)=r_t(1)*cos(q_t(1));
coor_t(21)=r_t(1)*sin(q_t(1));
t=1;
while r(t)>1e-1
    r(t+1)=(v_t*cos(sigma_t-q(t))-v_m)*dt+r(t);
    q(t+1)=v_t/r(t)*sin(sigma_t-q(t))*dt+q(t);
    sigma_m(t+1)=q(t+1);
    
    % calculate the coordinate in the station‘s
    n(2t)=v_m*(sigma_m(t+1)-sigma_m(t))/g;
r_m(t+1)=v_m*cos(sigma_m(t)-q_m(t))*dt+r_m(t);
    r_t(t+1)=v_t*cos(sigma_t-q_t(t))*dt+r_t(t);
    q_m(t+1)=v_m/r_m(t+1)*sin(sigma_m(t)-q_m(t))*dt+q_m(t);% care r_m(1)
    q_t(t+1)=v_t/r_t(t)*sin(sigma_t-q_t(t))*dt+q_t(t);
    t=t+1;
    coor_m(1t)=r_m(t)*cos(q_m(t));
    coor_m(2t)=r_m(t)*sin(q_m(t));
    coor_t(1t)=r_t(t)*cos(q_t(t));
    coor_t(2t)=r_t(t)*sin(q_t(t));
end
figure(2);
subplot(211);
plot(coor_m(1:)coor_m(2:)...
    ‘Color‘‘blue‘);%locus of missile
hold on;
plot(coor_t(1:)coor_t(2:)...
    ‘Color‘‘red‘);% locus of target
title(‘跟踪法轨迹‘);
subplot(212);
plot(n(2:));
title(‘法向过载‘);

%% proportion method
% the proportion
k=6;
clear q sigma_m r_m r_t;
% angel between missi

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        4543  2011-12-25 11:05  control_exp_missile.m

评论

共有 条评论