clc
clear
x=[150;85;150;145;130;0];
y=[140;85;155;50;150;0];
z=zeros(6,1);
oo=100;
minn=100;
for o1=243
z(1)=o1;
for o2=236
z(2)=o2;
for o3=223.5-1:0.01:223.5+1
z(3)=o3;
for o4=159
z(4)=o4;
for o5=230
z(5)=o5;
for o6=53-1:0.01:53+1
z(6)=o6;k=0;
for i=1:5
for j=i+1:6
v=800;
if z(i)<=90
t1=min((160-x(i))/(v*cosd(z(i))),(160-y(i))/(v*sind(z(i))));
elseif z(i)>90&&z(i)<=180
t1=min((0-x(i))/(v*cosd(z(i))),(160-y(i))/(v*sind(z(i))));
elseif z(i)>180&&z(i)<=270
t1=min((0-x(i))/(v*cosd(z(i))),(0-y(i))/(v*sind(z(i))));
else
t1=min((160-x(i))/(v*cosd(z(i))),(0-y(i))/(v*sind(z(i))));
end
if z(j)<=90
t2=min((160-x(j))/(v*cosd(z(j))),(160-y(j))/(v*sind(z(j))));
elseif z(j)>90&&z(j)<=180
t2=min((0-x(j))/(v*cosd(z(j))),(160-y(j))/(v*sind(z(j))));
elseif z(j)>180&&z(j)<=270
t2=min((0-x(j))/(v*cosd(z(j))),(0-y(j))/(v*sind(z(j))));
else
t2=min((160-x(j))/(v*cosd(z(j))),(0-y(j))/(v*sind(z(j))));
end
t=min(t1,t2);
aa=v^2*((cosd(z(i))-cosd(z(j)))^2+(sind(z(i))-sind(z(j)))^2);
bb=v*((x(i)-x(j))*(cosd(z(i))-cosd(z(j)))+(y(i)-y(j))*(sind(z(i))-sind(z(j))));
cc=(x(i)-x(j))^2+(y(i)-y(j))^2;
if bb>=0
d=cc;
elseif -bb>0&&-bb<aa*t
d=cc-bb^2/aa;
else
d=aa*t^2+2*bb*t+cc;
end
if d>64
l=1;
else
l=-1;
end
k=k+l;
if k==15
oo=abs(o1-243)+abs(o2-236)+abs(o3-220.5)+abs(o4-159)+abs(o5-230)+abs(o6-52);
k=0;
end
if k==15
oo=abs(o1-243)+abs(o2-236)+abs(o3-220.5)+abs(o4-159)+abs(o5-230)+abs(o6-52);
k=0;
end
if(oo<minn)
minn=oo;
end
if oo<=3.63
disp(o1); disp(o2);disp(o3);disp(o4);disp(o5);disp(o6);
end
end
end
end
end
end
end
end
end
文章来源地址https://www.toymoban.com/news/detail-858708.html
文章来源:https://www.toymoban.com/news/detail-858708.html
到了这里,关于数学建模飞行管理问题最简单易懂方法matlab代码的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!