【气动学】基于Matlab模拟各类导弹跟踪

1 内容介绍

一种基于Matlab的防空导弹二维弹道仿真方法.对导引规律和弹道仿真进行了探讨,以比例导引法为例,建立了防空导弹弹道仿真模型,讨论了部分参数的选取准则及其变化对弹道的影响,并使用Matlab语言进行了二维仿真​。

2 部分代码

close all;

clear all;

Vt = 200;

alphaT = 170;

xt0 = 10000;

yt0 = 800;

a_t = 0;%3*9.8;%

a_t_hor = a_t*cos(pi/2);

a_t_ver = a_t*sin(pi/2);

xm0 = 0;

ym0 = 0;

maxTime = 25;

delT = 0.1;

alphaT_rad = alphaT*(pi/180);

Vt_hor = Vt * cos(alphaT_rad);

Vt_ver = Vt * sin(alphaT_rad);

xt = xt0;

yt = yt0;

thetaT_rad = atan3(yt,xt);

thetaT = thetaT_rad * (180/pi);

del_thetaT = 0;

Rt = norm([xt yt],2);

Vm = Vt/0.6;

xm = xm0;

ym = ym0;

thetaM_rad = atan3(ym,xm);

thetaM = thetaM_rad * (180/pi);

alphaM_rad = atan3(yt-ym,xt-xm);

alphaM = alphaM_rad * (180/pi);

Vm_hor = Vm*cos(alphaM_rad);

Vm_ver = Vm*sin(alphaM_rad);

Rm = norm([xm ym],2);

del_Rm = 0;

K_p = 10;

figHandle = figure(1);

set(figHandle,'WindowStyle','docked');

f1 = subplot(1,3,1);

l1 = plot([0,xm,xt],[0,ym,yt],'b');

imgframe =0;

%     alphaT_rad = atan3((yt2-yt),(xt2-xt));

%     alphaT = alphaT_rad*(180/pi);

%     yt = yt2;

%     xt = xt2;

%     Vt_hor = Vt_hor+ (a_t_hor*delT);

%     Vt_ver = Vt_ver + (a_t_ver*delT);

    

    Rt = norm([xt yt],2);

    del_thetaT_rad = (Vt*sin(alphaT - thetaT_rad))/Rt;

    del_del_thetaT_rad = -(Vt*cos(alphaT - thetaT_rad) * del_thetaT)/Rt;

    thetaT_rad = thetaT_rad + del_thetaT_rad * delT;

%     thetaT2_rad = atan3(yt,xt);

%     del_thetaT2 = (thetaT2_rad - thetaT_rad)/delT;

%     del_del_thetaT = (del_thetaT2 - del_thetaT)/delT;

    

    a_m = (K_p * Rm * (thetaT_rad - thetaM_rad)) + (Rm*del_del_thetaT_rad) + (2*del_Rm*del_thetaT_rad);

%     a_m_hor = a_m*cos(pi/2 +alphaM_rad);%+ve x-axis

%     a_m_ver = a_m*sin(pi/2 +alphaM_rad);%+ve y-axis    

    alphaM_rad = a_m/Vm;    

%     alphaM_rad = atan3(ym2-ym,xm2-xm);

    alphaM = alphaM_rad * (180/pi);

    

    xm = xm + Vm_hor*delT;% + (1/2)*a_m_hor*(delT^2);

    ym = ym + Vm_ver*delT;% + (1/2)*a_m_ver*(delT^2);

%     xm = xm2;

%     ym = ym2;

    del_Rm = Vm*cos(alphaM_rad - thetaM_rad); % (Rm2 - Rm)/delT;    

    Rm = Rm + del_Rm*delT; % norm([xm ym],2);

%     Rm = Rm2;

    del_thetaM_rad = (Vm*sin(alphaM_rad - thetaM_rad))/Rm;

    thetaM_rad = del_thetaM_rad*delT;%atan3(ym,xm);

%     if t == 1

    pause(0.1);

%     end

%     f1 = figure(1);

%     set(f1,'WindowStyle','docked');

    f1 = subplot(1,3,1);

    box on;

    hold on;

    delete(l1);

    plot(xt,yt,'r*');    

    plot(xm,ym,'g*');

    l1 = plot([0 xt], [0 yt], 'b');

    xlabel('X-coordinate (meters)');

    ylabel('Z-coordinate (meters)');

        

%     f2 = figure(2);

%     set(f2,'WindowStyle','docked');

    f2 = subplot(1,3,2);

    box on;

    hold on;

    plot(t,R,'*b');

    xlabel('Time');

    ylabel('LOS Distance (meters)');

%     f3 = figure(4);

%     set(f3,'WindowStyle','docked');   

    f3 = subplot(1,3,3);

    box on;

    hold on;

    plot(t,a_m,'*r');

    xlabel('Time');

    ylabel('Lateral Acceleration (m/s^{2})');

    

    imgframe = imgframe+1;

    images1(imgframe) = getframe(figHandle);

end

for i = 1:imgframe-1

[im, map] = frame2im(images1(i));

name = ['clos_k10_mT_plot',num2str(i),'.jpg'];

imwrite(im,name,'jpg');

end

filename = 'clos_k10_mT';

save(filename);

movie2avi(images1,[filename '.avi'],'fps',4);

movie2avi(images1,[filename '_medium.avi'],'fps',5);

movie2avi(images1,[filename '_small.avi'],'fps',6);

% movie2avi(images1,[filename '_ffds.avi'],'Compression','FFDS','fps',4);

3 运行结果

【气动学】基于Matlab模拟各类导弹跟踪_第1张图片

4 参考文献

[1]郭锐, 刘荣忠. 基于MATLAB的导弹末敏子弹气动加热仿真[J]. 系统仿真学报, 2006, 18(12):3570-3571.

[2]许龙, 沈怀荣, 张聚铭,等. 基于MATLAB的导弹弹道建模与仿真[C]// 2012年第14届中国系统仿真技术及其应用学术年会. 2012.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机、雷达通信、无线传感器等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

 

你可能感兴趣的:(物理应用,matlab,开发语言)