%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% PLTprocess.m Process data from packet loss traces of
%% Yajhim, Moon, and Towsley.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
%clf
%% Load in data file and parameters.
%% Query user to dictate which one.
trnum = input('Which trace (1-9) ?')
%% Trace 1
if (trnum==1),
load 21.txt
trce = X21;
si = 80;
elseif (trnum==2),
%% Trace 2
load 22.txt
trce = X22;
si = 80;
elseif (trnum==3),
%% Trace 3
load 23.txt
trce = X23;
si = 160;
elseif (trnum==4),
%% Trace 4
load 24.txt
trce = X24;
si = 160;
elseif (trnum==5),
%% Trace 5
load 25.txt
trce = X25;
si = 20;
elseif (trnum==6),
%% Trace 6
load 26.txt
trce = X26;
si = 20;
elseif (trnum==7),
%% Trace 7
load 27.txt
trce = X27;
si = 20;
elseif (trnum==8),
%% Trace 8
load 28.txt
trce = X28;
si = 20;
elseif (trnum==9),
%% Trace 9
load 29.txt
trce = X29;
si = 40;
else,
disp('Input must be a number 1 through 9.')
end
% Check for entries of `11' for 1.
indvec = find(trce > 1);
if (length(indvec) > 0),
trce(indvec) = ones(size(indvec));
end
% Figure out step size by which to subsample packet traces,
% so as to conform to roughly maxsep ms between packets.
% YMT paper suggests 1000ms in abstract, but I think within or
% maybe Crovella suggested more like 650ms. Assumption is that
% autocorrelation is effectively zero by this point.
maxsep = 10000;
%maxsep = 1000;
nstep = floor(maxsep/si);
pktind = [1:nstep:nstep*floor(length(trce)/nstep)];
trce = trce(pktind);
% Aggregate into consecutive subsets of the sub-sampled trace,
% where each subset corresponds to time intervals of roughly
% m minutes.
nmin = 5;
%nmin = 1;
n = floor(nmin*60*1000/(nstep*si));
ncol = floor(length(trce)/n);
rshtrce = reshape(trce(1:n*ncol),n,ncol);
cnts = sum(rshtrce);
tt = [1:1:ncol]*n*nstep*si/(1000*60*60);
qq=input('Display plot of trace? (y/n)','s')
if strcmp(qq,'y')==1,
plot(tt,1 - cnts/n)
xlabel('Hours')
ylabel('Loss Rate')
end
% This code has been developed by Eric Kolaczyk and Robert Nowak.
% Copyright (c) Eric Kolaczyk and Robert Nowak, 2002.
% All rights reserved.