Home > src > BN_pol_rec > visualization > plot_threat_and_focus_change.m

plot_threat_and_focus_change

PURPOSE ^

SYNOPSIS ^

function fig = plot_threat_and_focus_change( great_data_struct, start, stop )

DESCRIPTION ^

 param: great_data_struct
 param: start - start time
 param: stop - stop time

 AUTHOR  Ronnie Johansson
 CREATED 2004-05-30
 ALTERED 2004-06-09 - adapted for multiple sensors
 ALTERED 2004-06-10 - minor changes

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function fig = plot_threat_and_focus_change( great_data_struct, start, stop )
0002 %
0003 % param: great_data_struct
0004 % param: start - start time
0005 % param: stop - stop time
0006 %
0007 % AUTHOR  Ronnie Johansson
0008 % CREATED 2004-05-30
0009 % ALTERED 2004-06-09 - adapted for multiple sensors
0010 % ALTERED 2004-06-10 - minor changes
0011 %
0012 
0013 fig = figure; 
0014 hold on;
0015 
0016 time = start:stop;
0017 
0018 % plot threat variation
0019 %subplot(2,1,1), hold on
0020 cmp_threats = [];
0021 for t=start:stop
0022   cmp_threats = [ cmp_threats; ptfc_getCmpThreat(great_data_struct(t-start+1).threat) ];
0023 end
0024 
0025 [dummy noOfEnemies] = size(cmp_threats);
0026 
0027 for e=1:noOfEnemies
0028   switch e
0029     case 1
0030       color = 'r';
0031       line = '-';
0032     case 2
0033       color = 'g';
0034       line = '-.';
0035     case 3
0036       color = 'b';
0037       line = '--';
0038     otherwise
0039       color = 'k';
0040       line = ':';
0041   end
0042   text_pos = [ stop cmp_threats(stop, e) ];
0043 
0044   plot(time, cmp_threats(:,e), [ color line ], 'LineWidth', 2);
0045 %  text(text_pos(1), text_pos(2), [ 'Company: ' num2str(e) ] , 'FontSize', 10, 'EdgeColor' , color)
0046      legend('Company 1', 'Company 2', 'Company 3');
0047 end
0048 title('Threat levels for all companies')
0049 xlabel('simulation time')
0050 ylabel('threat level')
0051 legend( 'Cmp1', 'Cmp2', 'Cmp3' )
0052 
0053 % plot targets selection
0054 %subplot(2,1,2), hold on
0055 
0056 tracked = [];
0057 
0058 sensors_init = great_data_struct(1).sensors;
0059 noOfSensors = length( sensors_init );
0060 
0061 for s=1:noOfSensors
0062   figure;
0063   hold on;
0064   axis([start stop 0 noOfEnemies]);
0065 
0066   sensor_id = sensors_init( s ).id;
0067   tracked = [];
0068   for t=start:stop
0069     sensors = great_data_struct(t-start+1).sensors;
0070     sensor_for_time_t = sensors( structfind( sensors, 'id', sensor_id ) );
0071     tracked = [tracked ptfc_transformToCmpNo( sensor_for_time_t.target_id )]; 
0072   end
0073 
0074   plot(time, tracked)
0075   xlabel('simulation time')
0076   ylabel('company tracked')
0077   title( ['Target allocations of sensor: ' sensor_id] )
0078 end
0079 
0080 
0081

Generated on Wed 16-Mar-2005 09:17:47 by m2html © 2003