> ><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.That's generally the best starting point for an approach, but for small phase angles, like 3 degrees, it isn't all that sensitive. Sensitivity can be increased by delaying one of the signals by enough samples to put them more like 60 degrees apart. You work out the phase difference with Vlad's equation, and then allow for the phase difference which your delay represents. That means you need to know the exact frequency of the signals, but if they are truly sine waves that isn't hard. Steve
Measuring small phase diffrences between two sampled signals.
Started by ●December 4, 2012
Reply by ●December 4, 20122012-12-04
Reply by ●December 4, 20122012-12-04
Tim Wescott <tim@seemywebsite.com> wrote: (snip, I wrote)>> 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.(snip)> I 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.Another one I once did was measuring the capacitance of electrochemical solar cells during an experiment. One coax cable supplies any DC bias, in addition to a 25mVAC (kT/e) reference. Another coax cable connects to the other side, terminated in a 10 or 100 ohm resistor. (Low enough frequencies not to worry about termination and reflections.) The (quadrature) current through the resistor is proportional to C, and is easily measured with the Lock-In Amplifier across the resistor. Interestingly, the cable capacitance pretty much doesn't affect the measurement, even though it can be much higher than that being measured. Another one, which was harder to get to work right, measures the voltage across the capacitor with a reference current through it. That one uses a large resistor to supply the AC reference current in addition to any DC bias, but is supposed to be a better measurement experimentally. -- glen
Reply by ●December 4, 20122012-12-04
"steveu" <31473@dsprelated> wrote in message news:ELGdnUnEfItBECPNnZ2dnUVZ_sydnZ2d@giganews.com...> > >><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. > > That's generally the best starting point for an approach, but for small > phase angles, like 3 degrees, it isn't all that sensitive. Sensitivity can > be increased by delaying one of the signals by enough samples to put them > more like 60 degrees apart. You work out the phase difference with Vlad's > equation, and then allow for the phase difference which your delay > represents. That means you need to know the exact frequency of the > signals, > but if they are truly sine waves that isn't hard.Just take a derivative of either A or B and correct the phase for -90 degrees. VLV
Reply by ●December 4, 20122012-12-04
On 12/4/12 8:17 PM, Vladimir Vassilevsky wrote:> "steveu"<31473@dsprelated> wrote in message > news:ELGdnUnEfItBECPNnZ2dnUVZ_sydnZ2d@giganews.com... >>> >>> <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. >> >> That's generally the best starting point for an approach, but for small >> phase angles, like 3 degrees, it isn't all that sensitive. Sensitivity can >> be increased by delaying one of the signals by enough samples to put them >> more like 60 degrees apart. You work out the phase difference with Vlad's >> equation, and then allow for the phase difference which your delay >> represents. That means you need to know the exact frequency of the >> signals, >> but if they are truly sine waves that isn't hard. > > Just take a derivative of either A or B and correct the phase for -90 > degrees.or the hilbert transform of either A or B (so the magnitude is not affected). then use the 4 quadrant atan2() instead of acos(). -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●December 5, 20122012-12-05
>On 12/4/12 8:17 PM, Vladimir Vassilevsky wrote: >> "steveu"<31473@dsprelated> wrote in message >> news:ELGdnUnEfItBECPNnZ2dnUVZ_sydnZ2d@giganews.com... >>>> >>>> <zoulzubazz@googlemail.com> wrote: >>>> >>>>> I was looking for a reliable method to measure phase differencesbetween>>> >>>>> 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 signalsare>>>>> being sampled at 2000KSa/sec. >>>> >>>> AB = |A||B|cos(fi) >>>> fi = acos(AB/|A||B|) >>>> >>>> If in doubt, remove DC from signals. >>> >>> That's generally the best starting point for an approach, but forsmall>>> phase angles, like 3 degrees, it isn't all that sensitive. Sensitivitycan>>> be increased by delaying one of the signals by enough samples to putthem>>> more like 60 degrees apart. You work out the phase difference withVlad's>>> equation, and then allow for the phase difference which your delay >>> represents. That means you need to know the exact frequency of the >>> signals, >>> but if they are truly sine waves that isn't hard. >> >> Just take a derivative of either A or B and correct the phase for -90 >> degrees. > >or the hilbert transform of either A or B (so the magnitude is not >affected). then use the 4 quadrant atan2() instead of acos().Of course atan2() is a wonderfully well behaved function, which gives super results for any angle. :-) You hand wave your idea, as though a Hilbert transform is a perfect solution, which it isn't. Any real world Hilbert transform has issues with either its gain or the accuracy of the 90 degree shift - typically a compromise of the two - and doesn't usually behave at all well near the ends of the band. If he's working with a 5kHz signal sampled at 2Msps, that's pretty close to the bottom of the band. If he downsamples, to move the signal closer to the middle of the band he'll be in better shape. However there will usually be some ripple in the gain, even if the transform is guaranteed to give a precise 90 degree shift across the band. That will spoil results. There really is more to a successful design than you suggest. If you are looking for a really fine resolution phase shift measurement what Vlad and I suggested is a low compute way to achieve results that are hard to beat. Regards, Steve
Reply by ●December 5, 20122012-12-05
On 12/5/12 12:27 AM, steveu wrote:>> On 12/4/12 8:17 PM, Vladimir Vassilevsky wrote: >>> "steveu"<31473@dsprelated> wrote in message >>> news:ELGdnUnEfItBECPNnZ2dnUVZ_sydnZ2d@giganews.com... >>>>> >>>>> <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. >>>> >>>> That's generally the best starting point for an approach, but for > small >>>> phase angles, like 3 degrees, it isn't all that sensitive. Sensitivity > can >>>> be increased by delaying one of the signals by enough samples to put > them >>>> more like 60 degrees apart. You work out the phase difference with > Vlad's >>>> equation, and then allow for the phase difference which your delay >>>> represents. That means you need to know the exact frequency of the >>>> signals, >>>> but if they are truly sine waves that isn't hard. >>> >>> Just take a derivative of either A or B and correct the phase for -90 >>> degrees. >> >> or the hilbert transform of either A or B (so the magnitude is not >> affected). then use the 4 quadrant atan2() instead of acos(). > > Of course atan2() is a wonderfully well behaved function, which gives super > results for any angle. :-) > > You hand wave your idea, as though a Hilbert transform is a perfect > solution, which it isn't. Any real world Hilbert transform has issues with > either its gain or the accuracy of the 90 degree shift - typically a > compromise of the two - and doesn't usually behave at all well near the > ends of the band.well anything that shifts 90 degrees is gonna have a problem at (and around) DC. including differentiators (how, exactly, will you do that?). it's always an issue on how low in frequency you need your Hilbert to work.> If he's working with a 5kHz signal sampled at 2Msps, > that's pretty close to the bottom of the band. If he downsamples, to move > the signal closer to the middle of the band he'll be in better shape. > However there will usually be some ripple in the gain, even if the > transform is guaranteed to give a precise 90 degree shift across the band. > That will spoil results. There really is more to a successful design than > you suggest.so here is what you do, you have an FIR filter that shifts -45 degrees (plus linear phase delay) and, if you reverse the coefficients of the filter, it's +45 (and the same linear-phase delay). they will have ripples at the same frequencies. they will have identical magnitude response. so the reference (signal A) goes through both the -pi/4 and +pi/4 filters (with the same delay) and the other signal (B) goes through just one of them. now you have both an in-phase and quadrature reference and the test signal. and they all go through a filter that has identical magnitude response at every frequency.> If you are looking for a really fine resolution phase shift measurement > what Vlad and I suggested is a low compute way to achieve results that are > hard to beat.how do you compensate for the frequency-dependent magnitude with the differentiator? how do you match that magnitude response for the signal that doesn't go through a differentiator? -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●December 5, 20122012-12-05
robert bristow-johnson <rbj@audioimagination.com> writes:> [...] > On 12/5/12 12:27 AM, steveu wrote: >> If you are looking for a really fine resolution phase shift measurement >> what Vlad and I suggested is a low compute way to achieve results that are >> hard to beat. > > how do you compensate for the frequency-dependent magnitude with the > differentiator? how do you match that magnitude response for the > signal that doesn't go through a differentiator?Damn you, Robert, why can't you just let people keep their head in the sand? -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Reply by ●December 5, 20122012-12-05
Hello guys, thanks for the speedy responses guys. The phase measurement is to be performed after the signals are acquired and saved. The noise levels are moderate although this needs to be quantified. The frequency remains constant through out. I was thinking of introducing equal phase delay to both signals and then try and measure the minute delay that i am after. cheerio. zoul On Wednesday, December 5, 2012 6:23:14 AM UTC, Randy Yates wrote:> robert bristow-johnson <rbj@audioimagination.com> writes: > > > [...] > > > On 12/5/12 12:27 AM, steveu wrote: > > >> If you are looking for a really fine resolution phase shift measurement > > >> what Vlad and I suggested is a low compute way to achieve results that are > > >> hard to beat. > > > > > > how do you compensate for the frequency-dependent magnitude with the > > > differentiator? how do you match that magnitude response for the > > > signal that doesn't go through a differentiator? > > > > Damn you, Robert, why can't you just let people keep their head in the > > sand? > > -- > > Randy Yates > > Digital Signal Labs > > http://www.digitalsignallabs.com
Reply by ●December 13, 20122012-12-13
A simple way to make such a 45 degree phase shift FIR filter is detailed in this article: http://www.claysturner.com/dsp/ASG.pdf IHTH, Clay p.s. The normalized inner product as given by Vlad is an excellent starting point for finding the angle between the vectors.
Reply by ●December 13, 20122012-12-13
On 12/13/12 9:07 AM, clay@claysturner.com wrote:> > A simple way to make such a 45 degree phase shift FIR filter is detailed in this article: > > http://www.claysturner.com/dsp/ASG.pdfnice paper. i've seen it before. setting aside the constant delay offset, we know we can get a -45 degree by mixing direct and quadrature. but they gotta be the same amplitude or the amplitude differences will result in a phase shift deviation from the -45 degrees. even though the amplitude won't be perfectly flat, we can make a (delayed) Hilbert transformer have a perfect -90 degree shift (in addition to the linear phase from the given delay). and i can make a perfect linear phase plus 0 degree shift, but the amplitude again won't be perfectly flat and may not match the amplitude of the Hilbert leg of this. i am curious, Clay, without reading it too much in detail (i know i should), does your method try to match the amplitudes of the two together to minimize the phase deviation from 45 after combining? we can make it so that the +45 and -45 have the exact same amplitude at each frequency (but it might not be flat). but can we make it so that they hit 45 degrees as well as we can hit 90 degrees? or is that simply an error tolerance that we design under?> p.s. The normalized inner product as given by Vlad is an excellent starting point for finding the angle between the vectors.it's a beginning, but it doesn't tell you which signal lags or leads the other. not without some other help. and you need to *normalize* which means another method of estimating the amplitude of both sinusoids. and the cosine function has a slope of zero at zero which makes it a little bit sloppy, numericially, for small phase differences. little errors in computing the normalized inner product become big errors in phase difference if the phase difference is small. and those little errors can come from little errors in estimating the amplitude. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."






