From: email@example.com (Tom Bruhns)
Subject: Re: Audio Phase meter cct wanted
Date: 18 Nov 2002 12:36:51 -0800
NNTP-Posting-Date: 18 Nov 2002 20:36:51 GMT
"John Jardine" wrote in message news:...
> Tom Bruhns wrote in message
> > Very simple circuit: digitizer, feeding a processor. In the
> > processor, do a DFT (e.g. Goertzel algorithm) on the frequency you're
> > interested in. If you run the algorithm on two inputs at the same
> > time, you can easily get the (apparent) phase difference; you can
> > pretty easily account for non-simultaneous sampling if you want. I'd
> > guess pretty much any processor with a hardware multiply could do the
> > task for audio frequencies, one freq at a time. If you do an FFT
> > instead of DFT, you can have a whole band of freqs. Depending on the
> > accuracy you need and the speed, even a built-in 8-bit ADC could be
> > enough, making for very few parts. Lots of options for the display.
> Looks interesting. I'd seen (a suggestion of) Goertzel's use wrt commercial
> LRC meters final phase extraction but had thought the Goertel was just a
> sharp bandpass filter?. Using say alternate, 'zig zag' sampled signals, how
> does the phase info' present itself?.
So...there are several questions in there, I guess. First off: you
can think of the DFT as a filter, and the FFT as a bank of those
filters at evenly spaced center frequencies. The Goertzel algorithm
is simply a way to do a DFT which divides the processing up so that
it's easy to do incrementally as the samples come in; it can look just
like an IIR biquad section that starts with zero initial conditions.
So, they are filters that implement a single complex pole pair. The
poles happen to be exactly on the z-domain unit circle...so they
effectively have infinite Q. They start at zero energy in the filter,
and after the appropriate number of samples, you look at the filter
state and from that you can get an amplitude and phase. Just how you
interpret the filter state depends on the exact configuration of the
filter biquad; you could use a "canonical" biquad, but I've found that
other configurations work better if the input frequency is a small
fraction of the sample rate. If you have two input waveforms and you
use a ping-pong sampler, you just need to account for the phase
difference between samples, in addition to the indicated phase
difference from the DFT output.
The "infinite Q" thing is a bit misleading, perhaps. Because you're
dealing with an input waveform which might be sinusoidal, but is
chopped off before sample 0 and after sample n-1, the filter has
effectively added a modulation and thus responds significantly to a
range of input frequencies, and in fact will have a sin(x)/x spectral
behavior: the transform of the rectangular modulation.
I realize there are a lot of details left out. If you do a bit of
reading about the Goertzel algorithm, you should find that you can
implement one in a few minutes in a spreadsheet like Excel, to play
with, so you can test your math. That's what I did before I tried to
program one in DSP assembly language. Rapidly learned that I needed
to be sure the filter state variables could hold large enough values!