% averages magnitudes together that are 'width' apart
function av = averager(v,width);
L = length(v);
last = floor(L/width);
av = zeros(L,1);
avg = zeros(last,1);

for i=1:last
   sum = 0;
   for j=1:width
      sum = sum + abs(v((i-1)*width + j));
   end
   sum = sum/width;
   avg(i,1) = sum;
end

for i=1:last
   for j=1:width
      av((i-1)*width + j,1) = avg(i);
   end
end

av = [av;zeros(L-last*width,1)];