nearly complete pre search function (corresponding to matlab script in rtl-sdr-LTE)