DSPRelated.com
Forums

Precise Measurement of Phase Angle Between 2 Signals w/ Noise

Started by Bret Cahill August 17, 2010
The SNR is between 2 and 10 and the frequency of most of the noise is
over a decade higher.

One solution might be to first integrate both signals at least once to
reduce the noise and to eliminate the number of crossings.  Then
several phase delays or shifters could create several crossings/cycle
to average several phase angle measurements/cycle.


Bret Cahill






On 08/17/2010 11:28 AM, Bret Cahill wrote:
> The SNR is between 2 and 10 and the frequency of most of the noise is > over a decade higher. > > One solution might be to first integrate both signals at least once to > reduce the noise and to eliminate the number of crossings. Then > several phase delays or shifters could create several crossings/cycle > to average several phase angle measurements/cycle.
Detecting zero crossing times in sampled signals is a good way to add lots of quantization noise. Usually when I need to detect the phase of a signal I use a multiplying phase detector, i.e. I multiply the signal by it's prototype sine wave, both inphase and quadrature parts. Then I average and take the arcsine. The nice thing about this is that it is it's own bandpass filter, and it's matched to what you're doing. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
On Aug 17, 11:28&#4294967295;am, Bret Cahill <BretCah...@peoplepc.com> wrote:
> The SNR is between 2 and 10 and the frequency of most of the noise is > over a decade higher. > > One solution might be to first integrate both signals at least once to > reduce the noise and to eliminate the number of crossings. &#4294967295;Then > several phase delays or shifters could create several crossings/cycle > to average several phase angle measurements/cycle.
Do you know the exact frequency of the signal? If so, shift one by 90 degrees. Correlate it and the shifted version against the other signal. Look at the ratio as atan2() for the angle. The longer the correlation the better the accuracy. Window (I find the Blackman-Nutall works well for this purpose), use an exact integer number of periods in the correlation, or both. IIf you don't know the exact frequency, you can do similar to the above using a windowed complex FFT after (re)referencing all the phases to the FFT aperture center (using fftshift if needed), and interpolating if needed, to get the phase angle of both signals with reference to the FFT aperture center, and then subtracting. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M http://www.nicholson.com/rhn/dsp.html
Ron N. <rhnlogic@yahoo.com> wrote:

>If so, shift one by 90 degrees. Correlate it and the shifted >version against the other signal. Look at the ratio as atan2() >for the angle. The longer the correlation the better the >accuracy. Window (I find the Blackman-Nutall works well for >this purpose), use an exact integer number of periods in the >correlation, or both.
Any reason to prefer Blackman-Nuttall over Nuttall? Steve
> > The SNR is between 2 and 10 and the frequency of most of the noise is > > over a decade higher. > > > One solution might be to first integrate both signals at least once to > > reduce the noise and to eliminate the number of crossings. &#4294967295;Then > > several phase delays or shifters could create several crossings/cycle > > to average several phase angle measurements/cycle. > > Do you know the exact frequency of the signal?
The frequency varies by about +/- 50%. The waveform is constantly varying as well. It isn't sinusoidal even without the noise. It looks craggy with the noise.
> If so, shift one by 90 degrees. &#4294967295;Correlate it and the shifted > version against the other signal. &#4294967295;Look at the ratio as atan2() > for the angle. &#4294967295;The longer the correlation the better the > accuracy. &#4294967295;Window (I find the Blackman-Nutall works well for > this purpose), use an exact integer number of periods in the > correlation, or both. > > IIf you don't know the exact frequency, you can do similar to the > above using a windowed complex FFT after (re)referencing all the > phases to the FFT aperture center (using fftshift if needed), > and interpolating if needed, to get the phase angle of both > signals with reference to the FFT aperture center, and > then subtracting. > > IMHO. YMMV. > -- > rhn A.T nicholson d.0.t C-o-M > &#4294967295;http://www.nicholson.com/rhn/dsp.html
Thanks. Is a lot of work done with constantly varying frequency and constantly changing waveform signals? Bret Cahill
> > The SNR is between 2 and 10 and the frequency of most of the noise is > > over a decade higher. > > > One solution might be to first integrate both signals at least once to > > reduce the noise and to eliminate the number of crossings. &#4294967295;Then > > several phase delays or shifters could create several crossings/cycle > > to average several phase angle measurements/cycle. > > Detecting zero crossing times in sampled signals is a good way to add > lots of quantization noise. > > Usually when I need to detect the phase of a signal I use a multiplying > phase detector, i.e. I multiply the signal by it's prototype sine wave
It's not sinusoidal even without the noise. Most of the noise may be OK and shouldn't cause any problems as far as phase angle is concerned (other than multiple crossings). That noise is simply incorporated into the [already] arbitrary waveform. It's easy, however, to get the prototype wave (along with the OK noise) if the phase angle is near zero and with some effort if the phase angle is known. Phi will generally be less than 5 degrees so maybe there are some small angle approximations that would do. "Precision" might be the wrong word. The phi could be off by 10% - to 20% if it was already near zero.
> both inphase and quadrature parts. &#4294967295;Then I average and take the arcsine. > > The nice thing about this is that it is it's own bandpass filter, and > it's matched to what you're doing.
Thanks. Is a lot done with waveforms & frequencies that vary over time? Bret Cahill
> Tim Wescott > Wescott Design Serviceshttp://www.wescottdesign.com > > Do you need to implement control loops in software? > "Applied Control Theory for Embedded Systems" was written for you. > See details athttp://www.wescottdesign.com/actfes/actfes.html
On 08/17/2010 02:19 PM, Bret Cahill wrote:
>>> The SNR is between 2 and 10 and the frequency of most of the noise is >>> over a decade higher. >> >>> One solution might be to first integrate both signals at least once to >>> reduce the noise and to eliminate the number of crossings. Then >>> several phase delays or shifters could create several crossings/cycle >>> to average several phase angle measurements/cycle. >> >> Do you know the exact frequency of the signal? > > The frequency varies by about +/- 50%. The waveform is constantly > varying as well. It isn't sinusoidal even without the noise. It > looks craggy with the noise.
How rapidly does the frequency change? How accurately do you need to measure the phase difference? How is the phase in the harmonics of the two versions related -- is one version a pure delay of the other, or is it filtered somehow? Regardless of how one goes about doing the measurement, if the signal frequency is varying rapidly enough it'll significantly complicate things. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
On 08/17/2010 02:37 PM, Bret Cahill wrote:
> >>> The SNR is between 2 and 10 and the frequency of most of the noise is >>> over a decade higher. >> >>> One solution might be to first integrate both signals at least once to >>> reduce the noise and to eliminate the number of crossings. Then >>> several phase delays or shifters could create several crossings/cycle >>> to average several phase angle measurements/cycle. >> >> Detecting zero crossing times in sampled signals is a good way to add >> lots of quantization noise. >> >> Usually when I need to detect the phase of a signal I use a multiplying >> phase detector, i.e. I multiply the signal by it's prototype sine wave > > It's not sinusoidal even without the noise. Most of the noise may be > OK and shouldn't cause any problems as far as phase angle is concerned > (other than multiple crossings). That noise is simply incorporated > into the [already] arbitrary waveform.
Then you need to know what you mean when you say "phase". If you mean the phase of the fundamental, great. If you mean the timing of some feature (a distinct edge, for instance), then that's great, too -- but this may not be the right technique, then.
> It's easy, however, to get the prototype wave (along with the OK > noise) if the phase angle is near zero and with some effort if the > phase angle is known. > > Phi will generally be less than 5 degrees so maybe there are some > small angle approximations that would do. > > "Precision" might be the wrong word. The phi could be off by 10% - to > 20% if it was already near zero. > >> both inphase and quadrature parts. Then I average and take the arcsine. >> >> The nice thing about this is that it is it's own bandpass filter, and >> it's matched to what you're doing. > > Thanks. Is a lot done with waveforms& frequencies that vary over > time?
It can be done, but life gets more complicated. Mostly, the frequency needs to be known, so you either have to be getting it from some other channel or you need to measure it. Whether the method makes sense for your case depends on a lot of details that you haven't given. I'd say that if you want to compare the phases of the two wave's fundamentals, and if the waveforms lack some really significant feature that you need to reference off of instead of the fundamental, and if the frequency is amenable to easy measurement (particularly if it's easy to track with a PLL), then this is a good method. Otherwise, you need to tell us more. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
On Aug 17, 2:19&#4294967295;pm, Bret Cahill <BretCah...@peoplepc.com> wrote:
> > Do you know the exact frequency of the signal? > > The frequency varies by about +/- 50%. &#4294967295;The waveform is constantly > varying as well. &#4294967295;It isn't sinusoidal even without the noise. &#4294967295;It > looks craggy with the noise.
If the frequency varies by that much and changes, exactly what do you mean by the phase angle between two signals? Does this angle somehow remain constant as the frequency varies? Or does the frequency remain stable for some time period? Or do you actually want to measure something else?
On Aug 17, 3:38&#4294967295;pm, "Ron N." <rhnlo...@yahoo.com> wrote:
> On Aug 17, 2:19&#4294967295;pm, Bret Cahill <BretCah...@peoplepc.com> wrote: > > > > Do you know the exact frequency of the signal? > > > The frequency varies by about +/- 50%. &#4294967295;The waveform is constantly > > varying as well. &#4294967295;It isn't sinusoidal even without the noise. &#4294967295;It > > looks craggy with the noise. > > If the frequency varies by that much and changes, exactly > what do you mean by the phase angle between two signals? > Does this angle somehow remain constant as the frequency > varies? &#4294967295;Or does the frequency remain stable for some time > period? &#4294967295;Or do you actually want to measure something else?