plot_delay

PURPOSE ^

plot for the msg and delay

SYNOPSIS ^

function plot_delay(par,msg)

DESCRIPTION ^

 plot for the msg and  delay

  INPUT
   par          parameters structure
   msg          messages structure

  OUTPUT


 $Id: plot_delay.m,v 1.1 2004/05/12 16:22:59 dalai Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % plot for the msg and  delay
0002 %
0003 %  INPUT
0004 %   par          parameters structure
0005 %   msg          messages structure
0006 %
0007 %  OUTPUT
0008 %
0009 %
0010 % $Id: plot_delay.m,v 1.1 2004/05/12 16:22:59 dalai Exp $
0011 
0012 function plot_delay(par,msg)
0013 
0014 
0015 % computations for the relative delay
0016 [tdx,pdf,par.delivered,par.dropped] = stat_delay(par,msg);
0017 
0018 % some stuff for the figure
0019 scrsz = get(0,'ScreenSize');
0020 fig = figure('Name',sprintf('delay distribution %s-%dmin-%dbs-%dusr',par.model,par.tmax/60,par.bs,par.mob),...
0021         'NumberTitle','off',...
0022         'Position',[1 5 scrsz(3)*4/5 scrsz(4)*4/5]);
0023 
0024 subplot(3,2,1);
0025 %plot(tdx,cummean(pdf))
0026 plot(tdx,pdf)
0027 axis([-10 (par.tmax+10) -0.1 max(max(pdf),0.1)])
0028 grid  ('on')
0029 xlabel('delay in s')
0030 ylabel('# messages delivered')
0031 title ('PDF')
0032 
0033 subplot(3,2,2);
0034 tdx2 = [1:par.tmax]/par.tmax;
0035 %plot(tdx2,cummean(pdf))
0036 plot(tdx2,pdf)
0037 axis([-0.01 1.01 -0.01 max(max(pdf),0.01)])
0038 grid  ('on')
0039 xlabel('delay / time simulation')
0040 ylabel('# messages delivered')
0041 title ('nomalized PDF')
0042 
0043 subplot(3,2,3);
0044 plot(tdx,cumsum(pdf))
0045 grid  ('on')
0046 xlabel('delay in s')
0047 ylabel('# messages delivered')
0048 title ('CDF')
0049 
0050 subplot(3,2,4)
0051 plot(tdx2,cumsum(pdf)./par.msg)
0052 axis([-0.01 1.01 -0.01 1.01])
0053 grid  ('on')
0054 xlabel('delay / time simulation')
0055 ylabel('# delivered / # generated')
0056 title ('normalized CDF')
0057 
0058 subplot(3,2,5);
0059 plot(tdx,cumsum(pdf)./par.msg)
0060 axis([-10 (par.tmax+10) -0.01 1.01])
0061 grid  ('on')
0062 xlabel('delay in s')
0063 ylabel('P(delivered)')
0064 title ('Probability of delivered vs. delay')
0065 
0066 subplot(3,2,6);
0067 plot(tdx2,cumsum(pdf)./par.msg)
0068 axis([-0.01 1.01 -0.01 1.01])
0069 grid  ('on')
0070 xlabel('delay / time simulation')
0071 ylabel('P(delivered)')
0072 title ('normalized Probability of delivered vs. delay')
0073 
0074 suptitle(sprintf('simulation for %d minutes for the %s model with %d base-stations and %d users\n %d messages non delivered and %d delivered out of %d generated',par.tmax/60,par.model,par.bs,par.mob,par.dropped,par.delivered,par.msg))
0075 
0076 refresh(fig)
0077 
0078 cd results
0079 %exportfig(gcf,sprintf('%s-%dmin-%dbs-%dusr.eps',par.model,par.tmax/60,par.bs,par.mob),'Color','cmyk');
0080 %saveas(gcf, sprintf('%s-%dmin-%dbs-%dusr.eps',par.model,par.tmax/60,par.bs,par.mob), 'fig')
0081 cd ..
0082 
0083 fig2 = figure('Name','delay distribution with absolute time','NumberTitle','off','Position',[1 5 scrsz(3)*4/5 scrsz(4)*1/3]);
0084 
0085 %test2 = struct2array(rmfield(msg,{'init_time' 'init_mob' 'nbr_hop'}));
0086 test2 = struct2array(rmfield(msg,{'init_time' 'init_mob'}));
0087 % compute the pdf
0088 tdx = [1:par.tmax];
0089 for idx=1:length(tdx)
0090     temp3 = test2(test2(:)>=tdx(idx)-1);
0091     temp4 = temp3(temp3(:)<tdx(idx));
0092     pdf2(tdx(idx)) = size(temp4,2);
0093 end
0094 
0095 subplot(1,3,1);
0096 %plot(tdx,cummean(pdf))
0097 plot(tdx,pdf2)
0098 axis([-10 (par.tmax+10) -0.1 max(max(pdf2),0.1)])
0099 grid  ('on')
0100 xlabel('absolute time in s')
0101 ylabel('# messages delivered')
0102 title ('# messages delivered vs. absolute time in s')
0103 
0104 subplot(1,3,2);
0105 %tdx2 = [1:par.tmax]/par.tmax;
0106 plot(tdx,cumsum(pdf2))
0107 axis([-10 (par.tmax+10) -0.1 (sum(sum(pdf2))+10)])
0108 grid  ('on')
0109 xlabel('absolute time in s')
0110 ylabel('# messages delivered')
0111 title ('CDF # messages delivered vs. absolute time in s')
0112 
0113 subplot(1,3,3);
0114 %cumsum3 = cumsum(pdf2)/max(cumsum(pdf2));
0115 cumsum3 = cumsum(pdf2)./par.msg;
0116 plot(tdx,cumsum3)
0117 axis([-10 (par.tmax+10) -0.01 1.01])
0118 grid  ('on')
0119 xlabel('absolute time in s')
0120 ylabel('# messages delivered')
0121 title ('normalized CDF # messages delivered vs. absolute time in s')
0122

Generated on Sun 15-Aug-2004 22:13:10 by m2html © 2003