Estimating the frequency of a periodic function