Hey fellow engineers, I was looking for a reliable method to measure phase differences between two sinusoidal signals with frequencies ranging between 5kHz-200kHz. The phase difference we are looking for is between the range of 3 degrees - 12degrees. What would be the best way to do this? Also both signals are being sampled at 2000KSa/sec. Thanks very much.
Measuring small phase diffrences between two sampled signals.
Started by ●December 4, 2012
Reply by ●December 4, 20122012-12-04
zoulzubazz@googlemail.com writes:> Hey fellow engineers, > > I was looking for a reliable method to measure phase differences > between two sinusoidal signals with frequencies ranging between > 5kHz-200kHz. The phase difference we are looking for is between the > range of 3 degrees - 12degrees. What would be the best way to do this? > Also both signals are being sampled at 2000KSa/sec.1) Hilbert transform each 2) compute angle of each (arctan(y/x)) 3) compute delta = theta2 - theta1 at each sample. 4) average delta over TBD samples. You could decimate before step 1) as well to something like 500 kHz. Yes, decimators and Hilbert transforms have delays, but if they're digital the delays are identical and cancel out in the delta. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Reply by ●December 4, 20122012-12-04
Randy Yates <yates@digitalsignallabs.com> writes:> zoulzubazz@googlemail.com writes: > >> Hey fellow engineers, >> >> I was looking for a reliable method to measure phase differences >> between two sinusoidal signals with frequencies ranging between >> 5kHz-200kHz. The phase difference we are looking for is between the >> range of 3 degrees - 12degrees. What would be the best way to do this? >> Also both signals are being sampled at 2000KSa/sec. > > 1) Hilbert transform each > > 2) compute angle of each (arctan(y/x)) > > 3) compute delta = theta2 - theta1 at each sample. > > 4) average delta over TBD samples. > > You could decimate before step 1) as well to something like 500 kHz. > > Yes, decimators and Hilbert transforms have delays, but if they're > digital the delays are identical and cancel out in the delta.PS: This is just a very rough idea. Many optimizations could be done, if needed. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Reply by ●December 4, 20122012-12-04
Le mardi 4 d�cembre 2012 17:15:17 UTC+1, zoulz...@googlemail.com a �crit�:> Hey fellow engineers, > > > > I was looking for a reliable method to measure phase differences between two sinusoidal signals with frequencies ranging between 5kHz-200kHz. The phase difference we are looking for is between the range of 3 degrees - 12degrees. What would be the best way to do this? Also both signals are being sampled at 2000KSa/sec. > > > > Thanks very much.Hello, I would say a simple and accurate approach, provided you don't need real-time tracking of the phase difference, would be : 1) Select an integer number of cycles 2) Discrete Fourier Transform of each signal at fundamental frequency 3) Compute the angles of the complex DFT results 4) Subtract the angles computed from each signal: that's the phase difference If you need some tracking, consider doing that over just one, or a couple of cycle(s). Of course I'm assuming both signals have the same frequency, otherwise the notion of phase difference is questionable. Another approach would be to use a "phase discriminator" principle like in phase lock loops : multiply the signal then lowpass.
Reply by ●December 4, 20122012-12-04
On Tue, 04 Dec 2012 08:15:17 -0800, zoulzubazz wrote:> Hey fellow engineers, > > I was looking for a reliable method to measure phase differences between > two sinusoidal signals with frequencies ranging between 5kHz-200kHz. The > phase difference we are looking for is between the range of 3 degrees - > 12degrees. What would be the best way to do this? Also both signals are > being sampled at 2000KSa/sec.Randy and Benoit both presented methods that would work. You didn't mention if you need to do this on line, off line, in real time, or with delay. Nor did you mention how rapidly the phase or frequency may vary, or how much noise there is on one or both of the signals. What method you'd choose depends on all of that (and more). Call the signals A and B. Assume that A is always lower noise (or as good as) B. Phase lock to signal A. Take the inphase and quadrature component of the reference signal (which is locked to A) and demodulate both A and B. Low-pass filter these inphase and quadrature signals (possibly with something as simple as an integrate-and-dump over an integer number of cycles) and use the demodulated I/Q pairs to calculate the phase of each signal with respect to the phase-locked reference. Subtract phases and enjoy. Randy's and Benoit's methods work better for batch processing where you can stand some delay. Mine works better if you need quick estimates of the phase, and if the phase is varying and the frequency is at least somewhat stable ("somewhat" depends on the noise level -- the more noise, the more stable your frequency needs to be). -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by ●December 4, 20122012-12-04
On 12/4/12 12:03 PM, Randy Yates wrote:> zoulzubazz@googlemail.com writes: > >> Hey fellow engineers, >> >> I was looking for a reliable method to measure phase differences >> between two sinusoidal signals with frequencies ranging between >> 5kHz-200kHz. The phase difference we are looking for is between the >> range of 3 degrees - 12degrees. What would be the best way to do this? >> Also both signals are being sampled at 2000KSa/sec. > > 1) Hilbert transform each > > 2) compute angle of each (arctan(y/x)) > > 3) compute delta = theta2 - theta1 at each sample. > > 4) average delta over TBD samples. >i don't think that one need Hilbert transform *both* signals. just the one that you're calling your reference sinusoid. and you will need both the in-phase (original) reference sinusoid and its quadrature (hilberted) sinusoid, which will be changed 90 degrees. and i am not sure why steps 2 and 3 comes before step 4. you cross-correlate both the in-phase reference and the quadrature reference against the signal under test (that you want to know its phase shift, relative to the reference). that involves multiplying and low-pass filtering. then those two values go into the arctan() (actually the 4-quadrant atan2() function - i guess that's not necessary if its 3 to 12 degrees) we've been here before at comp.dsp, but since Google Groups has become worthless as an archive lookup, i won't even try to find the old posts where this was put to bed. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●December 4, 20122012-12-04
Tim Wescott <tim@seemywebsite.please> wrote:> On Tue, 04 Dec 2012 08:15:17 -0800, zoulzubazz wrote:>> I was looking for a reliable method to measure phase differences between >> two sinusoidal signals with frequencies ranging between 5kHz-200kHz. The >> phase difference we are looking for is between the range of 3 degrees - >> 12degrees. What would be the best way to do this? Also both signals are >> being sampled at 2000KSa/sec.(snip)> Call the signals A and B. Assume that A is always lower noise (or as > good as) B. Phase lock to signal A. Take the inphase and quadrature > component of the reference signal (which is locked to A) and demodulate > both A and B. Low-pass filter these inphase and quadrature signals > (possibly with something as simple as an integrate-and-dump over an > integer number of cycles) and use the demodulated I/Q pairs to calculate > the phase of each signal with respect to the phase-locked reference. > Subtract phases and enjoy.(snip) Sounds somewhat like the Lock-In Amplifier commonly used in physics and engineering experiments. http://en.wikipedia.org/wiki/Lock-in_amplifier They come on a box with BNC connectors for input and output, and can easily be connected up to various experimental systems. You can use either the internal oscillator as the reference or external reference source. As you note, the reference is usually lower noise, and usually doesn't have so much gain on its input. Internally, then, it generates I (in-phase) and Q (quadrature) square waves locked to the reference, multiplies them by the input (usually with gain before and/or after), filters the results (as both I and Q) with variable cut-off filters. The traditional ones output (and usually display on panel meters) the I and Q outputs. Fancier ones have the option to generate amplitude and phase outputs (still analog). (And BNC outputs that can, for example, be connected to external recording equipment.) I haven't followed the technology lately, but I would guess that they are now more digital than they used to be. As an example, if you want to measure the light output from an LED even with a large background, modulating the current with the reference and filtering the output of a detector through the Lock-in amplifier, allows one to extract a small signal from a large amount of noise. You could measure the emission spectrum from the LED by detecting the output of a monochromator/photomultiplier system, for example. -- glen
Reply by ●December 4, 20122012-12-04
On Tue, 04 Dec 2012 20:29:47 +0000, glen herrmannsfeldt wrote:> Tim Wescott <tim@seemywebsite.please> wrote: >> On Tue, 04 Dec 2012 08:15:17 -0800, zoulzubazz wrote: > >>> I was looking for a reliable method to measure phase differences >>> between two sinusoidal signals with frequencies ranging between >>> 5kHz-200kHz. The phase difference we are looking for is between the >>> range of 3 degrees - 12degrees. What would be the best way to do this? >>> Also both signals are being sampled at 2000KSa/sec. > > (snip) > >> Call the signals A and B. Assume that A is always lower noise (or as >> good as) B. Phase lock to signal A. Take the inphase and quadrature >> component of the reference signal (which is locked to A) and demodulate >> both A and B. Low-pass filter these inphase and quadrature signals >> (possibly with something as simple as an integrate-and-dump over an >> integer number of cycles) and use the demodulated I/Q pairs to >> calculate the phase of each signal with respect to the phase-locked >> reference. Subtract phases and enjoy. > > (snip) > > Sounds somewhat like the Lock-In Amplifier commonly used in physics and > engineering experiments. > > http://en.wikipedia.org/wiki/Lock-in_amplifier > > They come on a box with BNC connectors for input and output, and can > easily be connected up to various experimental systems. > > You can use either the internal oscillator as the reference or external > reference source. As you note, the reference is usually lower noise, and > usually doesn't have so much gain on its input. > > Internally, then, it generates I (in-phase) and Q (quadrature) square > waves locked to the reference, multiplies them by the input (usually > with gain before and/or after), filters the results (as both I and Q) > with variable cut-off filters. > > The traditional ones output (and usually display on panel meters) the I > and Q outputs. Fancier ones have the option to generate amplitude and > phase outputs (still analog). (And BNC outputs that can, for example, be > connected to external recording equipment.) > > I haven't followed the technology lately, but I would guess that they > are now more digital than they used to be. > > As an example, if you want to measure the light output from an LED even > with a large background, modulating the current with the reference and > filtering the output of a detector through the Lock-in amplifier, allows > one to extract a small signal from a large amount of noise. > > You could measure the emission spectrum from the LED by detecting the > output of a monochromator/photomultiplier system, for example. > > -- glenI should remember that, since I've used the technique quite a bit in the past. It's a great way of pulling an AC-coupled signal out of the mud. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Reply by ●December 4, 20122012-12-04
robert bristow-johnson <rbj@audioimagination.com> writes:> On 12/4/12 12:03 PM, Randy Yates wrote: >> zoulzubazz@googlemail.com writes: >> >>> Hey fellow engineers, >>> >>> I was looking for a reliable method to measure phase differences >>> between two sinusoidal signals with frequencies ranging between >>> 5kHz-200kHz. The phase difference we are looking for is between the >>> range of 3 degrees - 12degrees. What would be the best way to do this? >>> Also both signals are being sampled at 2000KSa/sec. >> >> 1) Hilbert transform each >> >> 2) compute angle of each (arctan(y/x)) >> >> 3) compute delta = theta2 - theta1 at each sample. >> >> 4) average delta over TBD samples. >> > > i don't think that one need Hilbert transform *both* signals. just > the one that you're calling your reference sinusoid. and you will > need both the in-phase (original) reference sinusoid and its > quadrature (hilberted) sinusoid, which will be changed 90 degrees. > > and i am not sure why steps 2 and 3 comes before step 4. > > you cross-correlate both the in-phase reference and the quadrature > reference against the signal under test (that you want to know its > phase shift, relative to the reference). that involves multiplying > and low-pass filtering. then those two values go into the arctan() > (actually the 4-quadrant atan2() function - i guess that's not > necessary if its 3 to 12 degrees) > > we've been here before at comp.dsp, but since Google Groups has become > worthless as an archive lookup, i won't even try to find the old posts > where this was put to bed.There are few ways to do this - I think you're talking about one of the other ways. Also, as I posted in a follow-up, this was just a rough, top-level idea. You could do arctan(z1 * z2^C) to save an arctan and a subtraction in exchange for a complex multiply - probably a good idea if computational complexity is any concern. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Reply by ●December 4, 20122012-12-04
<zoulzubazz@googlemail.com> wrote:>I was looking for a reliable method to measure phase differences between >two sinusoidal signals with frequencies ranging between >5kHz-200kHz. The >phase difference we are looking for is between the range of 3 degrees - >12degrees. What would be the best >way to do this? Also both signals are >being sampled at 2000KSa/sec.AB = |A||B|cos(fi) fi = acos(AB/|A||B|) If in doubt, remove DC from signals. Vladimir Vassilevsky DSP and Mixed Signal Consultant www.abvolt.com






