Sign in

username:

password:



Not a member?

Search compdsp



Search tips

comp.dsp by Keywords

Adaptive Filter | ADPCM | ADSP | ADSP-2181 | Aliasing | AMR | Anti-Aliasing | ARMA | Autocorrelation | AutoCovariance | Beamforming | Bessel | Blackfin | Butterworth | C6713 | CCS | Chebyshev | CIC Filter | Circular Convolution | Code Composer Studio | Comb Filter | Compression | Convolution | Cross Correlation | DCT | Decimation | Deconvolution | Demodulation | DM642 | DSP Boards | DSP/BIOS | DTMF | Echo Cancellation | Equalization | Equalizer | ETSI | EZLITE (Ez-kit Lite) | FFT | FFTW | FIR Filter | Fixed Point | FSK | G.711 | G.723 | G.729 | Gaussian Noise | Goertzel | GPIO | Hilbert Transform | IFFT | IIR Filter | Interpolation | Invariance | JTAG | Kalman | Laplace Transform | Levinson | LPC | McBSP | MIPS | Modulation | MPEG | Multirate | Notch Filter | Nyquist | OFDM | Oversampling | Pink Noise | Pitch | PLL | Polyphase | QAM | QDMA | Quantization | Quantizer | Radar | Random Noise | Reed Solomon | Remez | Resampling | RTDX | Sampling | Sharc | TI C6711 | Undersampling | Viterbi | Wavelets | White Noise | Wiener Filter | Windowing | XDS510PP | Z Transform

Sponsor

Industry's highest performing at the lowest power DSPs now as low as $5.00*
Start development today!
*volume pricing for 10ku

Discussion Groups

Free Online Books

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Comp.DSP | Phase measurement techniques

There are 8 messages in this thread.

You are currently looking at messages 0 to 8.


Phase measurement techniques - Al Clark - 2006-02-16 13:16:00

I have a customer that needs to measure the phase difference between two 
signals.

Here are some of the parameters:

1. The waveform is very oversampled.
2. Each signal may have a different amplitude
3. Averaging the result is allowable.
4. The signal is relatively noise free.

I know that there are FFT methods, but I think this may be more work than 
necessary.

One thought is just looking at the samples at both sides of the zero 
crossings and interpolating the zero crossings from this data. The 
measurements could be averaged over multiple zero crossings to improve the 
accuracy.

This seems a little crude. Does anyone have a simple more elegant solution? 
Calculations are being performed in a SHARC so accuracy, MIPs, floating 
point or fixed point issues are not of too much concern.   




-- 
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Phase measurement techniques - Tim Wescott - 2006-02-16 13:23:00



Al Clark wrote:

> I have a customer that needs to measure the phase difference between two 
> signals.
> 
> Here are some of the parameters:
> 
> 1. The waveform is very oversampled.
> 2. Each signal may have a different amplitude
> 3. Averaging the result is allowable.
> 4. The signal is relatively noise free.
> 
> I know that there are FFT methods, but I think this may be more work than 
> necessary.
> 
> One thought is just looking at the samples at both sides of the zero 
> crossings and interpolating the zero crossings from this data. The 
> measurements could be averaged over multiple zero crossings to improve the 
> accuracy.
> 
> This seems a little crude. Does anyone have a simple more elegant solution? 
> Calculations are being performed in a SHARC so accuracy, MIPs, floating 
> point or fixed point issues are not of too much concern.   
> 
> 
> 
> 
If the frequency is known exactly you can modulate each signal with 
quadrature sine waves at the frequency, average, & take the arc tangent. 
  I use this sort of thing quite a lot for various tasks.  Come to think 
of it, this may work even with some frequency variation -- finding the 
frequency variation vs. phase accuracy is left as an exercise to the 
reader (or call me off line and we'll arrange a contract).

You may be able to do this just by delaying one signal (call it a 
'narrow-band Hilbert transform') and using the undelayed + delayed 
signals for the I and Q, then just do two MAC operations instead of 
four.  If the frequency _isn't_ exactly known you could extend the 
bandwidth of your 90 degree phase shift enough that you wouldn't have to 
put the quote marks around 'Hilbert transform' -- the length of the 
filter you'd want to implement would start out small (1 sample?) and 
increase as the frequency uncertainty grew and the need for phase 
accuracy shrank.

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Posting from Google?  See http://cfaj.freeshell.org/google/
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Phase measurement techniques - Mike Yarwood - 2006-02-16 13:54:00

"Al Clark" <d...@danvillesignal.com> wrote in message 
news:Xns976C7CD1C915Caclarkdanvillesignal@66.133.129.71...
>I have a customer that needs to measure the phase difference between two
> signals.
>
> Here are some of the parameters:
>
> 1. The waveform is very oversampled.
> 2. Each signal may have a different amplitude
> 3. Averaging the result is allowable.
> 4. The signal is relatively noise free.
>
> I know that there are FFT methods, but I think this may be more work than
> necessary.
>
> One thought is just looking at the samples at both sides of the zero
> crossings and interpolating the zero crossings from this data. The
> measurements could be averaged over multiple zero crossings to improve the
> accuracy.
>
> This seems a little crude. Does anyone have a simple more elegant 
> solution?
> Calculations are being performed in a SHARC so accuracy, MIPs, floating
> point or fixed point issues are not of too much concern.
>
Could you identically LPF and decimate both signals?  If you know what the 
period is then shift the oversampled input delay on one of the streams till 
you get a maximum on the product of the two filter o/ps integrated over the 
period.  It doesn't sound terribly elegant though does it?

Best of luck - Mike


______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Phase measurement techniques - 2006-02-16 20:21:00

Al Clark <d...@danvillesignal.com> writes:

> One thought is just looking at the samples at both sides of the zero 
> crossings and interpolating the zero crossings from this data. The 
> measurements could be averaged over multiple zero crossings to improve the 
> accuracy.
> 
> This seems a little crude. Does anyone have a simple more elegant solution? 
> Calculations are being performed in a SHARC so accuracy, MIPs, floating 
> point or fixed point issues are not of too much concern.   

Estimate the time delay:

http://cnx.rice.edu/content/m11243/latest/

and convert to a phase by knowing the frequency. :-)

Ciao,

Peter K.

-- 
"And he sees the vision splendid 
of the sunlit plains extended
And at night the wondrous glory of the everlasting stars."

 
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Phase measurement techniques - Al Clark - 2006-02-16 20:30:00

Tim Wescott <t...@seemywebsite.com> wrote in
news:C...@web-ster.com: 

> Al Clark wrote:
> 
>> I have a customer that needs to measure the phase difference between
>> two signals.
>> 
>> Here are some of the parameters:
>> 
>> 1. The waveform is very oversampled.
>> 2. Each signal may have a different amplitude
>> 3. Averaging the result is allowable.
>> 4. The signal is relatively noise free.
>> 
>> I know that there are FFT methods, but I think this may be more work
>> than necessary.
>> 
>> One thought is just looking at the samples at both sides of the zero 
>> crossings and interpolating the zero crossings from this data. The 
>> measurements could be averaged over multiple zero crossings to
>> improve the accuracy.
>> 
>> This seems a little crude. Does anyone have a simple more elegant
>> solution? Calculations are being performed in a SHARC so accuracy,
>> MIPs, floating point or fixed point issues are not of too much
>> concern.   
>> 
>> 
>> 
>> 
> If the frequency is known exactly you can modulate each signal with 
> quadrature sine waves at the frequency, average, & take the arc
> tangent. 
>   I use this sort of thing quite a lot for various tasks.  Come to
>   think 
> of it, this may work even with some frequency variation -- finding the
> frequency variation vs. phase accuracy is left as an exercise to the 
> reader (or call me off line and we'll arrange a contract).
> 
> You may be able to do this just by delaying one signal (call it a 
> 'narrow-band Hilbert transform') and using the undelayed + delayed 
> signals for the I and Q, then just do two MAC operations instead of 
> four.  If the frequency _isn't_ exactly known you could extend the 
> bandwidth of your 90 degree phase shift enough that you wouldn't have
> to put the quote marks around 'Hilbert transform' -- the length of the
> filter you'd want to implement would start out small (1 sample?) and 
> increase as the frequency uncertainty grew and the need for phase 
> accuracy shrank.
> 

OK, I think I get the idea,

You are basically measuring the phase of each individual signal relative 
to the reference. If you know these values, you can calculate the 
difference between the two signals.

In this case, I think the sampling rate is an integer multiple of the 
signal of interest, so the hilbert transform could probably be just an N 
sample delay.

Thank you for your help.  

-- 
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Phase measurement techniques - Ikaro - 2006-02-16 22:01:00

Hi,

You can also estimate the delay by looking at the index of the maximum
value of the cross-correlation between the signals.
This might not be as efficient as solutions mentioned above
though...but will give you an accuracy of Ts and requires no
assumptions on
the frequency and/or the amplitude of the signals (if your data is
several periods long).

______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Phase measurement techniques - Michael Soyka - 2006-02-17 23:08:00

Al Clark wrote:
> I have a customer that needs to measure the phase difference between two 
> signals.
> 
> Here are some of the parameters:
> 
> 1. The waveform is very oversampled.
> 2. Each signal may have a different amplitude
> 3. Averaging the result is allowable.
> 4. The signal is relatively noise free.
> 
> I know that there are FFT methods, but I think this may be more work than 
> necessary.
> 
> One thought is just looking at the samples at both sides of the zero 
> crossings and interpolating the zero crossings from this data. The 
> measurements could be averaged over multiple zero crossings to improve the 
> accuracy.
> 
> This seems a little crude. Does anyone have a simple more elegant solution? 
> Calculations are being performed in a SHARC so accuracy, MIPs, floating 
> point or fixed point issues are not of too much concern.   
> 
> 
> 
> 
If the signal is a sine wave, the SNR is high, and you know the 
frequency, you can estimate the amplitude and phase by fitting it to a 
sine wave.

For example, let x[n] be samples of your signal and let "omega" be the 
known radian frequency.  Assume the signal can be modeled by
     A * sin(omega*n/Fs + phi)
where
     A is the unknown amplitude,
     Fs is the sample rate, and
     phi is the unknown phase.

Setup a system of equations:

     x[0] = A*sin(0+phi)
     x[1] = A*sin(omega*1/Fs+phi)
       :        :

Now express the model as
     A*sin(omega*n/Fs)cos(phi) + Acos(omega*n/Fs)sin(phi)

The system can now be expressed as a matrix equation:

     | x[0] |   | sin(omega*0/Fs) cos(omega*0/Fs) |
     | x[1] |   | sin(omega*1/Fs) cos(omega*1/Fs) |  | Acos(phi) |
     |  :   | = |        :                :       |  | Asin(phi) |
     |  :   |   |        :                :       |

where the 2x1 vector on the right is unknown and the matrix and vector 
on the left are known.  Invert the matrix to estimate the unknown vector 
  and phi = arctan(sin(phi)/cos(phi))

Do this for both signals.

Mike
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Phase measurement techniques - Clay S. Turner - 2006-02-18 15:17:00

"Al Clark" <d...@danvillesignal.com> wrote in message 
news:Xns976C7CD1C915Caclarkdanvillesignal@66.133.129.71...
>I have a customer that needs to measure the phase difference between two
> signals.
>
> Here are some of the parameters:
>
> 1. The waveform is very oversampled.
> 2. Each signal may have a different amplitude
> 3. Averaging the result is allowable.
> 4. The signal is relatively noise free.

Hello Al,

If the signal is highly sinusoidal (dominated by a single harmonic), then a 
simple dot product is all you need.

If the above case is true, then

theta = acos (  (A dot B)/sqrt( (A dot A)*(B dot B) )

The shift in samples is just theta*period/2pi

And the angular shift relative to the period is theta/2pi

If your signal contains harmonics, then this method will measure them as 
well but with an incorrect frequency, so the result will be affected.

On the other hand, if your signal is harmonic rich, then find an FFT of each 
signal, form a vector of Hermitian products between the two FFTs, find the 
argument of each of the inner product terms. Find the slope of this argument 
function verses frequency and this is the exact relative delay between the 
two signals. If you know your period, then you have the phase shift. 
Alteratively after finding the Hermitian inner products, then form I(omega) 
= real(inner product) and Q(omega) = imag(inner product), and then find (I 
dQ - Q dI) / (I^2 + Q^2). Finally average together all of these terms to get 
the delay. You may even use a weighted average for this last step where the 
weights come from the power density of the waveform.


IHTH,

Clay S. Turner



>
> I know that there are FFT methods, but I think this may be more work than
> necessary.
>

This depends on the harmonic content of the waveform and the needed 
accuracy.




______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.