资源简介
MATLAB 用基本蚁群算法进行二维路径规划,后面还有画图显示。

代码片段和文件信息
function path = DijkstraPlan(positionsign)
%% 基于Dijkstra算法的路径规划算法
%position input %节点位置
%sign input %节点间是否可达
%path output %规划路径
%% 计算路径距离
cost = ones(size(sign))*10000;
[nm] = size(sign);
for i = 1:n
for j = 1:m
if sign(ij) == 1
cost(ij) = sqrt(sum((position(i:)-position(j:)).^2));
end
end
end
%% 路径开始点
dist = cost(1:); %节点间路径长度
s = zeros(size(dist)); %节点经过标志
s(1) = 1;dist(1) = 0;
path = zeros(size(dist)); %依次经过的节点
path(1:) = 1;
%% 循环寻找路径点
for num = 2:n
% 选择路径长度最小点
mindist = 10000;
for i = 1:length(dist)
if s(i) == 0
if dist(i)< mindist
mindist = dist(i);
u = i;
end
end
end
% 更新点点间路径
s(u) = 1;
for w = 1:length(dist)
if s(i) == 0
if dist(u)+cost(uw) < dist(w)
dist(w) = dist(u)+cost(uw);
path(w) = u;
end
end
end
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 190 2009-09-04 09:54 chapter23\barrier.txt
文件 1158 2010-11-17 08:41 chapter23\DijkstraPlan.m
文件 0 2010-11-17 08:29 chapter23\DijstraPlan.m
文件 122 2009-07-19 18:08 chapter23\lines.txt
文件 5601 2010-12-29 10:43 chapter23\main.m
文件 989 2009-08-05 18:33 chapter23\matrix.txt
目录 0 2011-08-28 11:14 chapter23
----------- --------- ---------- ----- ----
8060 7
- 上一篇:低秩表示模型
- 下一篇:布拉格光栅MATLAB反射谱仿真
相关资源
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
- k近邻算法matlab实现
- matlab识别系统
评论
共有 条评论