基于北方苍鹰优化算法NGO的复杂城市地形下无人机避障三维航迹规划,可以修改障碍物及起始点(Matlab代码)

一、部分代码

close all
clear 
clc
rng('default');
%% 载入数据
data.S=[50,950,12];     %起点位置 横坐标与纵坐标需为50的倍数
data.E=[950,50,1]; %终点点位置 横坐标与纵坐标需为50的倍数
data.Obstacle=xlsread('data1.xls');
data.numObstacles=length(data.Obstacle(:,1));
%% 画图
figure
hold on
plot(curve,'r','LineWidth',2)
xlabel('迭代次数')
ylabel('路径长度')
legend(str);
[~,result]=fobj(Best_pos);
drawPc(result,option,data,str)
result.path(:,1)=result.path(:,1).*data.unit(1);
result.path(:,2)=result.path(:,2).*data.unit(2);
result.path(:,3)=result.path(:,3).*data.unit(3);
%% 显示路径信息
fprintf("路径坐标:\n");
display(result.path)
fprintf("路径长度:%f\n",result.fit);

二、部分结果

路径坐标:

  50  950  12

  50  900  11

  50  900  10

  100  850   9

  150  800   9

  150  750   9

  150  750  10

  200  750  11

  250  750  10

  300  700  10

  350  700   9

  400  700   8

  450  650   7

  450  600   7

  500  550   6

  500  550   5

  500  500   5

  500  450   6

  500  400   5

  500  350   4

  550  300   4

  600  300   4

  650  300   3

  700  300   4

  750  300   3

  750  250   3

  800  250   3

  850  200   3

  850  150   2

  900  100   1

  950  50   1

路径长度:1539.544374

三、完整MATLAB代码

  • 5
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值