function [newWaves,amplifications,rawevstatsL2] = amplificationControl(newWaves,time,ampMin,ampMax,rawevstatsL2)
amplifications = getAmplifications(newWaves,time);

goodAmps1 = ( amplifications(:,5) > ampMin );
goodAmps2 = (amplifications(:,5) < ampMax );
goodAmps  = goodAmps1 .* goodAmps2;

bads = newWaves(:,~logical(goodAmps),2);

% figure(10);
% plot(bads);
% title('bad amplifications')
% xlabel('time, (x1e-10)')
% ylabel('voltage')

newWaves = newWaves(:,logical(goodAmps),:);

amplifications = getAmplifications(newWaves,time);


rawevstatsL2(6) = sum(~logical(goodAmps));