clear all
close all

samplesPerHalfCycle = 5;
cyclesPerAmp = 3;
numAmplitudes = 3;
 amplitudes = [.9 1 1.1];

index = 1;
sig(index) = 0;
for i=1:numAmplitudes
    for j=1:cyclesPerAmp
        for k= 1:2*samplesPerHalfCycle
            index = index + 1;
            if k<=samplesPerHalfCycle
                sig(index) = 1 * amplitudes(i);
            else
                sig(index) = -1 * amplitudes(i);
            end
        end
    end
end
sig(index+1) = 0;

plot(sig)  

sig2 = sqrt(sig.^2);

figure
plot(sig2)

bins = [.85 .95 1.05 1.15];
for i=1:length(bins)-1
    ind{i,:} = find( (sig2 >= bins(i)) & sig2 < bins(i+1) );
end
