plot_trace.m

来自「多智能体工具包」· M 代码 · 共 56 行

M
56
字号
function plot_trace(HISTORY,Age)% PLOT_TRACE	Plot the trajectory for robots.%     Copyright (c) 1997-2000 Jiming Liu and Jianbing WuLoop_Inc=5;Robot_Num=3;  Point_X=0;  Point_Y=0;  View_Width=10;  End_X=Point_X+View_Width;  End_Y=Point_Y+View_Width;%plot(Point_X,Point_Y,'color',[1 1 1]);plot(0,1,'color',[1 1 1]);%axis([Point_X,End_X,Point_Y,End_Y]);axis([0,7,1,8]);%axis on;hold on;if Age>70  plot(HISTORY(1,4),HISTORY(1,5),...        'LineStyle','o','Color','y',...        'erasemode','xor','markersize',40/View_Width);endplot(HISTORY((Age-1)*Loop_Inc+1,4),HISTORY((Age-1)*Loop_Inc+1,5),...        'LineStyle','+','Color','g',...        'erasemode','xor','markersize',40/View_Width);  for mm=1:(Robot_Num+1)    LocationX=HISTORY((Age-1)*Loop_Inc+mm+1,4);    LocationY=HISTORY((Age-1)*Loop_Inc+mm+1,5);    if HISTORY((Age-1)*Loop_Inc+mm+1,1)==1 | HISTORY(Age*Loop_Inc+mm+1,1)==2      Line_Style='*';      Cell_Color='r';      Mark_Size=30/View_Width;    elseif HISTORY(Age*Loop_Inc+mm+1,1)==3      Line_Style='.';      Cell_Color='w';      Mark_Size=80/View_Width;    end    plot(LocationX,LocationY,'LineStyle',Line_Style,'Color',Cell_Color,...         'erasemode','xor','markersize',Mark_Size);  end%Title_Text=['(t=' num2str(Age) ')'];%title(Title_Text);drawnow;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?