我是靠谱客的博主 辛勤铃铛,这篇文章主要介绍导弹巡航追踪目标模拟程序(1)源码版--matlab导弹巡航追踪目标模拟程序–matlab,现在分享给大家,希望可以做个参考。

导弹巡航追踪目标模拟程序–matlab

1说明(接各类代码定制)

  • 本文是对书本教材中一个特定问题的模拟分析。
  • 文中的内容只作为理论推导,无实际意义
  • 代码的运行环境为matlab 2020a
  • 本文主要源码直接分享展示,后续会更新建立gui模拟程序
  • 转载请注明来源,本文代码为原创内容。

2更新进度

  • 示意图展示
  • 源码程序
  • 数学模型过程
  • gui界面

3背景简介

  • 导弹追击目标过程包括三个过程:
  • 1.直行过程 导弹向目标方位附近直行接近目标。
  • 2.导弹巡航搜敌过程,导弹在完成设定的直行距离会开始圆周绕行过程,通过扇面角辐射范围寻找目标。
  • 3.当目标接近导弹设定距离时,启动尾追程序。当导弹接近目标的距离到预警距离时,目标会出现回避行为用于规避尾追。

4追击过程的示意图

4.1寻找目标过程图

在这里插入图片描述

4.2尾追目标示意图

在这里插入图片描述

4.3接近目标时的规避行为示意图

在这里插入图片描述

5 构建导弹巡航模型的数学过程

相关数学模型部分可以参考下列文献。本文使用的具体过程会在后续更新中补齐。

复制代码
1
2
3
4
[1]陈道升, 郑晓庆, 梁朝阳,等. 潜艇规避对声自导鱼雷命中 概率的影响[J]. 测试技术学报, 2014(5). [2]张江, 张静远, 潘逊. 反潜鱼雷齐射作战能力仿真分析[C]

6 巡航程序gui界面

在这里插入图片描述

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

7巡航模拟源程序

  • 7.1 主程序
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
%% 鱼雷攻击潜艇过程 %% 只在第一次仿真展示击中图 clc clear close all %% 开始仿真 cp_x_max=7;%仿真变动点数目 cpp_1_max=200;%仿真次数 cf_p_max=2; %发射次数 for cp_x=1:cp_x_max %仿真变动数目10个点 hh=0; for cpp_1=1:cpp_1_max %仿真次数 % close all time_name=0;%判断前一次运行是否击中 %% 发射次数 for cf_p=1:cf_p_max %发射次数 %% 基础参数 c_torpedo=0; %鱼雷回避角度 shf=75;%鱼雷自导扇面角 t_cx=10;% 发射间隔时间 Rd=2000;%自导距离 v=20;%直行速度12m/s mat_len=10000;%最大航行距离 if hh==0 && cf_p~=1 % t1=floor(normrnd(mat_len/(4*v),0.2*mat_len/(3*v))); % 直行时间 t1=120; else t1=120; end v_cs=10;%船速 w1=deg2rad(12);%环形旋转角度 r=1000; %环形半径 %% 改变敌舷角参数 Initial_distance_2=pi/(3);%初始敌舷角 Interval_variation_2=0;%变动的敌舷角步长 if cf_p==1 Qm=Initial_distance_2+normrnd(Interval_variation_2*cp_x,Interval_variation_2*pi/12);%敌舷角 else % Qm=Qm+deg2rad(t_cx*1);%敌舷角 Qm=atan((t_cx*v_cs*sin(stat_way)-torpedo_x(end))/(t_cx*v_cs*cos(stat_way)-torpedo_y(end))); end %% 初始变动距离 % 0.1的正态误差 Initial_distance=4200;%初始距离 Interval_variation=0;%变动的间隔 if cf_p==1 x_target=[normrnd(Initial_distance+Interval_variation*(cp_x-1),Interval_variation*0.1)*cos(Qm),normrnd(Initial_distance+Interval_variation*(cp_x-1),Interval_variation*0.1)*sin(Qm)]; %仿真变动 else if c_torpedo~=0 %判断是否进行了偏转 x_target(1)=torpedo_x(end); x_target(2)=torpedo_y(end); else x_target(1)=x_target(1)+mV*v*t_cx*cos(c_P); %x角度变化 x_target(2)=x_target(2)+mV*v*t_cx*sin(c_P); %y角度变化 end end %% 速度比设定 Initial_distance_3=0.1;%速度比 Interval_variation_3=0.05;%速度比 if Initial_distance_3+Interval_variation_3*cp_x >=1 %速度比 disp('本次仿真不可靠') end if cf_p==1 mV=Initial_distance_3+normrnd(Interval_variation_3*cp_x,0.02); %速度比 if mV >=1 mV=1; end else mV=mV; end %% 方向角变动 Initial_distance_4=0;%目标运行的角度方向 Interval_variation_4=0;%目标运行的角度方向 if cf_p==1 % c_P=Initial_distance_4+normrnd(Interval_variation_4*cp_x,pi/12);%目标运行的角度方向 c_P=Initial_distance_4+normrnd(Interval_variation_4*cp_x,Interval_variation_4*pi/12);%目标运行的角度方向 else c_P=c_P; end %% 计算鱼雷射击有利提前角 r_x=deg2rad(shf);%角度转弧度 Ds=sqrt((x_target(1))^2+(x_target(2))^2); K=2*sin(r_x)/3*r_x; beta=asin(K*mV*Rd*(sin(Qm)/(Ds+K*mV*Rd*cos(Qm)))); c_a=asin(mV*sin(Qm-beta))-beta; w=0; %% 初始船航向 Initial_distance_5=0;%目标运行的角度方向 Interval_variation_5=0;%目标运行的角度方向 if cf_p==1 stat_way=Initial_distance_5+Interval_variation_5*cp_x; %船头起始方向 end c=c_a+deg2rad(stat_way)+Qm; %% 初始方向选择 鱼雷 % r=abs(v/w1);%回旋半径 CT_A=c; %航向 max_t=floor((mat_len)/v);% torpedo_x=x_target(1); torpedo_y=x_target(2); if cf_p==1 x_t=zeros(max_t,1); y_t=zeros(max_t,1); else clear x_t y_t x_t=[t_cx*v_cs*cos(stat_way);zeros(max_t-1,1)]; y_t=[t_cx*v_cs*sin(stat_way);zeros(max_t-1,1)]; end %% 步进计算鱼雷位置 for t=2:max_t c=c+w; %% 更新目标位置 if t==1 torpedo_x(t)=torpedo_x(t)+(1-mV)*v*cos(c_P);%更新目标位置 torpedo_y(t)=torpedo_y(t)+(1-mV)*v*sin(c_P);%更新目标位置 x_target(1)=torpedo_x; x_target(2)=torpedo_y; else torpedo_x(t)=torpedo_x(t-1)+(1-mV)*v*cos(c_P);%更新目标位置 torpedo_y(t)=torpedo_y(t-1)+(1-mV)*v*sin(c_P);%更新目标位置 x_target(1)=torpedo_x(t); x_target(2)=torpedo_y(t); end %% 开始判断是否环绕 if t<=t1 x_t(t)=x_t(t-1)+v*cos(c); y_t(t)=y_t(t-1)+v*sin(c); t2=t; else a=w1*(t1-t); x_t(t)=x_t(t2)+r*cos((CT_A)+pi/2*sign(a))+r*cos((CT_A)-pi/2*sign(a)+a); y_t(t)=y_t(t2)+r*sin((CT_A)+pi/2*sign(a))+r*sin((CT_A)-pi/2*sign(a)+a); x_length=sqrt((x_t(t)-x_target(1))^2+(y_t(t)-x_target(2))^2); if t==max_t && x_length>Rd && cpp_1==1 %当达到最大时,展示图 figure(cp_x) plot(x_t(1:t),y_t(1:t),'k-') hold on plot(torpedo_x(1),torpedo_y(1),'*-') hold on plot(torpedo_x,torpedo_y,'r-') end %% 判断是否接近敌人 if x_length<=Rd op=atan(y_t(t)-x_target(2)/(x_t(t)-x_target(1))); disp('接近敌') a_xx = (y_t(t)-x_target(2))/norm(x_t(t)-x_target(1)); teta=rad2deg(dot(a_xx, a)); if teta<shf*2|| cf_p==1 A = v*mV; %目标速度 %仿真变动 B = v;%鱼雷速度 xf_s=[x_t(t),y_t(t)];%当前鱼雷位置 xf_q=[x_target(1),x_target(2)];%目标位置 if cf_p==1 figure(cp_x) end if cpp_1==1 plot(x_t(1:t),y_t(1:t),'k-') hold on end t_has=max_t-t; %% 判断尾追过程 [hh_t,torpedo_x,torpedo_y]=ch_test(xf_s,xf_q,A,B,t_has,cpp_1,c_P,c_torpedo); time_name=1*hh_t+time_name; if time_name == 1 hh=1*hh_t+hh; end break %跳出大循环 end end end end end hh_all(cp_x,1)=hh; hh_all(cp_x,2)=cpp_1; end end %% 绘制概率结果图 if Interval_variation~=0 figure plot(Initial_distance:Interval_variation:(cp_x-1)*Interval_variation+Initial_distance,hh_all(:,1)./hh_all(:,2),'-*') title('敌方位置变动') ylabel('命中率') xlabel('初始雷目距离') ylim([-0.1,1.1]) end if Interval_variation_2~=0 figure plot(rad2deg(Initial_distance_2:Interval_variation_2:(cp_x-1)*Interval_variation_2+Initial_distance_2),hh_all(:,1)./hh_all(:,2),'-*') title('敌方初始敌舷角变动') ylabel('命中率') xlabel('敌舷角') end if Interval_variation_3~=0 figure plot(Initial_distance_3:Interval_variation_3:(cp_x-1)*Interval_variation_3+Initial_distance_3,hh_all(:,1)./hh_all(:,2),'-*') title('敌方速度比变动') ylabel('命中率') xlabel('速度比') ylim([-0.1,1.1]) end if Interval_variation_4~=0 figure plot(Initial_distance_4:Interval_variation_4:(cp_x-1)*Interval_variation_4+Initial_distance_4,hh_all(:,1)./hh_all(:,2),'-*') title('敌方移动方向变动') ylabel('命中率') xlabel('目标运行的角度方向') ylim([-0.1,1.1]) end if Interval_variation_5~=0 figure plot(Initial_distance_5:Interval_variation_5:(cp_x-1)*Interval_variation_5+Initial_distance_5,hh_all(:,1)./hh_all(:,2),'-*') title('船初始移动方向变动') ylabel('命中率') xlabel('船初始方向') ylim([-0.1,1.1]) end
  • 7.2尾追过程程序
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
function [hh,torpedo_x,torpedo_y,xf_s,B_N]=ch_test(xf_s,xf_q,A,B,t_has,cpp_1,c_p,c) % clc % clear % close all % A = 6; %目标速度 % B = 18;%导弹速度 hh=0; cx=deg2rad(c_p);%起始移动 % c=90;%目标回旋角度 c_rad=deg2rad(c)+cx; cu=0; % x_1=20; % t_has=100;% tspan = [0 ,t_has+eps]; %模拟的时间范围 % xf_s=[ 607 386]; % xf_q=[895,-986]; L = norm([xf_s-xf_q]);%计算两点距离 cat=atan((xf_s(2)-xf_q(2))/(xf_s(1)-xf_q(1))); if sign(cat)==-1 y0 = [cat+pi L]; %初始值, 曲线方向,初始相距距离 elseif xf_s(2)<xf_q(2) y0 = [cat+pi L]; %初始值, 曲线方向,初始相距距离 else y0 = [cat L]; %初始值, 曲线方向,初始相距距离 end [t,y] = ode45(@(t,y) odefcn(t,y,A,B), tspan, y0); torpedo_x=xf_q(1); torpedo_y=xf_q(2); for t_t=1:size(y,1) vm=A; A_n=vm*t(t_t); B_N(t_t)=A_n+complex(xf_q(1),xf_q(2))+y(t_t,2)*exp(1i*y(t_t,1)); % B_N(t_t)=B_N(t_t)+exp(1i*cx); cel_xy=[torpedo_x(1,t_t);torpedo_y(1,t_t)]; ax=sqrt((cel_xy(2)-imag(B_N(t_t)))^2+(cel_xy(1)-real(B_N(t_t)))^2); if ax<=200 if cpp_1==1 hold on plot_rust(xf_s,B_N,torpedo_x,torpedo_y) %运行仿真,注释调 end % disp('击中') hh=1; break elseif t_t>=size(y,1)+1 % disp('未击中') end if t_t<=10 && norm([cel_xy-B_N(t_t)])>=500 torpedo_x(t_t+1)=torpedo_x(t_t)+vm*cos(cx); torpedo_y(t_t+1)=torpedo_y(t_t)+vm*sin(cx); else torpedo_x(t_t+1)=torpedo_x(t_t)+vm*cos(c_rad); torpedo_y(t_t+1)=torpedo_y(t_t)+vm*sin(c_rad); end end if cpp_1==1 % hh=1; plot_rust(xf_s,B_N,torpedo_x,torpedo_y) %运行仿真,注释调 end end function plot_rust(xf_s,B_N,torpedo_x,torpedo_y) plot(xf_s(1),xf_s(2),'b*') hold on plot(B_N,'g-') hold on plot(torpedo_x(1),torpedo_y(1),'*-') hold on plot(torpedo_x,torpedo_y,'r-') hold on end function dydt = odefcn(t,y,vm,vt) dydt = zeros(2,1); dydt(1)=-vm*sin(y(1))/y(2); dydt(2)=-vt-vm*cos(y(1));%-deg2rad(75)*t; end
  • 7.3 尾追简化模型
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% clc % clear % close all function [x1,x2]=test_u(cansu) t=cansu(1); H=cansu(2); Ve=cansu(3); Vw=cansu(4); % t=0.1; %运行步长 % H=1200; %距离 % Ve=90;%目标速度 % Vw=300;%导弹速度 % h=H/ n; lamda=Ve / Vw ; y(1)=cansu(6); x(1)=cansu(5);p(1)=0;T(1)=5; for i=1:100 %迭代次数 M= (Ve*T(i)-x(i))/ (H-y(i) ); x1(i+1)=x(i)+Vw*t/ sqrt (1+1/M.^2) ; y1(i+1)=y(i)+Vw*t / sqrt (1+M.^2); T(i+1)=i*t; x(i+1)=0.5*(x1(i+1)+x(i)+Vw*t/sqrt (1+((H-y1(i+1) )/ (Ve*T(i+1)-x1(i+1)) ).^2) ) ; y(i+1)=0.5*(y1(i+1)+y(i )+Vw*t/sqrt(1+( (Ve*T(i+1)-x1(i+1))/(H-y1(i+1) ) ).^2) ); if y (i+1)>=H break; end end [T;x;y]' L=x(i+1) T=x(i+1)/Ve plot(x1,y1) hold on x2=H*ones(1,size(x,2)); plot(x1,x2) ylabel('y坐标') xlabel('x坐标') end

8 模拟结果图

在这里插入图片描述

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

9 模拟说明

10 gui完整展示

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

11 gui说明书

弹道仿真软件app说明书

  1. 设计环境:matlab2020b
  2. 运行环境要求win10 包含matlab离线支持包
  3. 主要功能描述:
    1)实现鱼雷追究目标过程的可视化过程。展示的运行分为直行、环绕、尾追、命中判定。2)通过设定参数仿真不同条件下命中结果的变化大小。
    3)设定目标潜艇的不同规避方式研究不同规避方式过程中命中率变化。
    4)软件包含对仿真的结果分析与保存。
  4. 设计app的算法流程:
    5 仿真APP的界面展示
  5. 仿真结果展示:
  6. 设计思路:
    1)输入初始仿真参数
    2)判断输入参数的合理性
    3)选择对应的仿真模型
    4)将参数带入预先设计的数学模型
    5)展示仿真过程中鱼雷与目标的位置轨迹图
    6)根据需求保存对应文件
  1. 展示命中结果
    8)分析仿真数据

最后

以上就是辛勤铃铛最近收集整理的关于导弹巡航追踪目标模拟程序(1)源码版--matlab导弹巡航追踪目标模拟程序–matlab的全部内容,更多相关导弹巡航追踪目标模拟程序(1)源码版--matlab导弹巡航追踪目标模拟程序–matlab内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(106)

评论列表共有 0 条评论

立即
投稿
返回
顶部