function new=peak(x)
x = x(:,2)';
x = x(2500:4036);
x = xcorr(x,x);
x = x((length(x)-1)/2:length(x));
count2 = 0;
s = 0;
n = 4036 - 2500;
for count=1:n
    s = x(count) + s;
    count2 = count2+1;
end
ave = s / count2;
s = 0;
while count2 > n/10
    count2 = 0;
    for count=1:n
        if x(count) > ave
            s = x(count)+s;
            count2 = count2+1;
        else
            x(count) = 0;
        end
    end
    ave = s / count2;
    s = 0;
end
for count=1:n
    if x(count) > 0
        x(count) = 1;
    else
        x(count) = 0;
    end
end
plot(x);



