資源簡介
用matlab寫的A*算法,可自行定義Target,Start與Obstacle
代碼片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%?A*?ALGORITHM?Demo
%?Interactive?A*?search?demo
%?04-26-2005
%???Copyright?2009-2010?The?MathWorks?Inc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%DEFINE?THE?2-D?MAP?ARRAY
MAX_X=27;
MAX_Y=27;
%MAX_VAL=10;
%This?array?stores?the?coordinates?of?the?map?and?the?
%objects?in?each?coordinate
MAP=2*(ones(MAX_XMAX_Y));
%?Obtain?Obstacle?Target?and?Robot?Position
%?Initialize?the?MAP?with?input?values
%?Obstacle=-1Target?=?0Robot=1Space=2
j=0;
x_val?=?1;
y_val?=?1;
axis([1?MAX_X+1?1?MAX_Y+1])
set(gca‘xtick‘1:1:28)
set(gca‘ytick‘1:1:28)
grid?on;
hold?on;
n=0;%Number?of?Obstacles
%?BEGIN?Interactive?Obstacle?Target?Start?Location?selection
pause(1);
h=msgbox(‘Please?Select?the?Target?using
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????7433??2016-04-17?14:42??allpointselected\A_Star1.m
?????文件????????201??2016-04-15?23:31??allpointselected\distance.m
?????文件???????1824??2014-02-12?13:02??allpointselected\expand_array.m
?????文件????????596??2014-02-12?13:02??allpointselected\insert_open.m
?????文件???????1047??2016-04-16?17:57??allpointselected\min_fn.m
?????文件????????297??2014-02-12?13:02??allpointselected\node_index.m
?????目錄??????????0??2016-04-17?14:41??allpointselected
-----------?---------??----------?-----??----
????????????????11398????????????????????7
評論
共有 條評論