"M.L." wrote: > On Thu, May 28, 2009 at 1:10 PM, Peter Restall wrote: > > On Thu, 28 May 2009 11:13:40 -0400, M.L. wrote: > > > You can't detect a 60kHz signal with a 26.7kHz sample rate. I just > > > ran an Octave simulation of the Goertzel algorithm and I was able > > > to get good results with something like this: > > > > Thanks for the input Martin - I'll have a play about with your script a > > little later. > > Very simply, sampling theory says that you need to sample at least twice > as fast as the maximum frequency you want to look at. So if you sampled > at 10kHz the maximum frequency you can see is 5kHz (with much distortion). > You will get numbers if your Goertzel code is trying to detect a frequency > > sample speed, but they won't be correct. Too simple. Technically, you need to sample at greater than twice the *bandwidth* you're interested in, and that bandwidth doesn't need to start at zero frequency. Subsampling a narrow-bandwidth signal (relative to its carrier frequency) is a perfectly respectable technique, as long as you understand how the aliasing is affecting the signal you're interested in (and any interfering signals or noise). Also, your analog front end and the sampler itself need to be able to correctly handle the frequency of the carrier. And obvioulsy, you use a bandpass filter, rather than a lowpass filter, to eliminate unwanted aliases. In a way, it's the discrete-time version of what a superheterodyne receiver does in continuous time. -- Dave Tweed -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist