show_result.m
来自「多智能体工具包」· M 代码 · 共 90 行
M
90 行
% SHOW_RESULT Draw the results through the complete experiments.% Copyright (c) 1997-2000 Jiming Liu and Jianbing Wuclose all;clear all;FLname='f1_2';%FLname='f1_2f2_2f6_4';%FLname='f2_1';%FLname='f6_2';Max_Age=101; Loop_Inc=5;Robot_Num=3;eval(['load ' FLname ';']); % load the DATAForce_Object=[];Force_Direct=[];Dist_GoalObject=[];Stand_Dist=[];Robot_Step=[];for mm=1:Max_Age Object_Config=New_History(mm*Loop_Inc,4:5); Goal_Config=New_History((mm-1)*Loop_Inc+1,4:5); Diff_Config=Object_Config-Goal_Config; dist_GO_now=sqrt(Diff_Config(1)^2+Diff_Config(2)^2); Dist_GoalObject=[Dist_GoalObject dist_GO_now]; Begin_Row=(mm-1)*Loop_Inc+2; End_Row=Begin_Row+Robot_Num-1; Robot_Config=New_History(Begin_Row:End_Row,4:5); [Sum_Force,Force_Direction,Force_Vector]=calcuforce(... Robot_Config,Object_Config,Robot_Num); Force_Object=[Force_Object Sum_Force]; Force_Direct=[Force_Direct Force_Direction]; if mm>1 Last_Object=New_History((mm-1)*Loop_Inc,4:5); Object_Diff=Last_Object-Object_Config; Step_Now=sqrt(Object_Diff(1)^2+Object_Diff(2)^2); end Robot_Step=[Robot_Step Step_Now]; Total_Dist=0; for mm=1:Robot_Num Diff_Now=Robot_Config(mm,:)-Object_Config; Total_Dist=Total_Dist+sqrt(Diff_Now(1)^2+Diff_Now(2)^2)/Robot_Num; end Stand_Dist=[Stand_Dist Total_Dist]; endxx=0:100;yy=1:100;subplot(3,2,1);plot(xx,Force_Object);grid on;ylabel('SUM(F)');subplot(3,2,2);plot(yy,Robot_Step);grid on;ylabel('Step');subplot(3,2,3); plot(xx,Force_Direct); grid on;ylabel('Angle(F)'); subplot(3,2,4); plot(xx,Stand_Dist); grid on;ylabel('Aver(Dor)'); subplot(3,2,5); plot(xx,Dist_GoalObject); grid on;ylabel('Dgo'); xlabel('t');subplot(3,2,6);plot(xx,New_Gen);grid on;ylabel('Fitness');xlabel('t');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?