• 大小: 2KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-01
  • 语言: 其他
  • 标签: 龙格库塔  

资源简介

利用常微分方程的龙格库塔法解算弹道,并进行弹道优化,得到最优参数

资源截图

代码片段和文件信息

clc;
clear;
m0=15800;
mp=12912;
tall=115;%发动机点火时间
P=260680;
mu=3.986004e14;
R=6378.14e3;
t1=3;
t2=20;%经估算,加速40s后,导弹速度约为0.8Ma
alp=-1/57.3;
c=-mp/tall;%秒耗量
tout=[];
yout=[];
r=[];
height=[];
yout(1:)=[0 0 0 0 m0];
i=1;
h=0.1;
for t=0:h:1000
    tout(i1)=t;
    r(i1)=sqrt(yout(i1)^2+(R+yout(i2))^2);
    height(i1)=r(i1)-R;
    gr=-mu/(r(i1)^2);
   
    if t>2
       if height(i1)<10
          break
        end
    end

    if t>0
        the=atan(yout(i4)/yout(i3));
    end
    
    if t<3
        phi=90/57.3;
    elseif t<20
        phi=the+alp;
    elseif t<115
        phi=the;
    else
        phi=the; 
        c=0; 
        P=0;
    end
    
    K1m=h*c;
    K2m=h*c;
    K3m=h*c;
    K4m=h*c;
    
    K1x=h*yout(i3);
    K2x=h*(yout(i3)+K1x/2);
    K3x=h*(yout(i3)+K2x/2);
    K4x=h*(yout(i3)+K3x);
    
    K1y=h*yout(i4);
    K2y=h*(yout(i4)+K1y/2);
    K3y=h*(yout(i4)+K2y/2);
    K4y=h*(yout(i4)+K3y); 
    
    K1vx=h*(P/yout(i5)*cos(phi)+gr/r(i1)*yout(i1));
    K2vx=h*(P/(yout(i5)+K1m/2)*cos(phi)+gr/r(i1)*(yout(i1)+K1x/2));
    K3vx=h*(P/(yout(i5)+K2m/2)*cos(phi)+gr/r(i1)*(yout(i1)+K2x/2));
    K4vx=h*(P/(yout(i5)+K3m)*cos(phi)+gr/r(i1)*(yout(i1)+K3x));
    
    K1vy=h*(P/yout(i5)*sin(phi)+gr/r(i1)*(R+yout(i2)));
    K2vy=h*(P/(yout(i5)+K1m/2)*sin(phi)+gr/r(i1)*(R+yout(i2)+K1y/2));
    K3vy=h*(P/(yout(i5)+K2m/2)*sin(phi)+gr/r(i1)*(R+yout(i2)+K2y/2));
    K4vy=h*(P/(yout(i5)+K3m)*sin(phi)+gr/r(i1)*(R+yout(i2)+K3y));  
    
    yout(i+11)=yout(i1)+1/6*(K1x+2*K2x+2*K3x+K4x);
    yout(i+12)=yout(i2)+1/6*(K1y+2*K2y+2*K3y+K4y);
    yout(i+13)=yout(i3)+1/6*(K1vx+2*K2vx+2*K3vx+K4vx);
    yout(i+14)=yout(i4)+1/6*(K1vy+2*K2vy+2*K3vy+K4vy);
    yout(i+15)=yout(i5)+1/6*(K1m+2*K2m+2*K3m+K4m);
    i=i+1;
end

figure(1);
plot(yout(:1)/1000yout(:2)/1000);
grid on;
title(‘导弹在发射坐标系下的轨迹‘);
xlabel(‘x/km‘);ylabel(‘y/km‘);
        
  

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        2025  2012-12-20 10:32  弹道Runge-Kutta法\RungeKuttamain.m
     文件        1943  2012-12-20 10:32  弹道Runge-Kutta法\zhudong.m
     目录           0  2013-03-03 11:20  弹道Runge-Kutta法\

评论

共有 条评论