DSPRelated.com
Forums

High Accuracy Phase calculation between two sine waves - MATLAB

Started by kara...@gmail.com January 25, 2011
Hi,

I am trying to find the phase difference between two sine waves using matlab to an accuracy of 4 decimal places. That means I want to be able to detect a phase difference as small as 1e-4 radians. I am using a 12bit A/D. Both signals are of the same frequency(50Hz), and the SNR is 2:1(yes, its a high noise environment). I have tried many different ways but cant get an accuracy of more than 2 decimal places. Some methods I have tried are -:

1. I have tried to find the zerocrossing and hence detect the time difference to find the phase but doesn't work for high accuracy.

2.I have also tried to find the cross-correlation of the two signals and detect the max time lag at the peak. This method give me a 3 decimal accuracy but still not good enough.

For the these two methods I used a high sampling frequencies like 50KHz 500Khz 1MHz and 100Mhz. The last one gave me the best results which is understandable as the closer the samples the more accurate they will be but at that high a sampling frequency designing filters for a 50Hz signal with 500 to 5Khz range of noise is hard, almost impossible in matlab. I am not sure what filter to use there.

3. I also tried sina*sinb, the product to sum rule. I took the time avg. of the resulting wave to eliminate the time varying component and tried taking the arccos of the DC component that contained teh phase information.

4. I also tried sina+sinb, the sum to product rule and then took the magnitude to calculate the phase difference.

The problem I faced with the above two methods is that the arccosine function is extremely sensitive and hence the accuracy is there but the stability is not due to noise.

For the above described problem I have a the following questions -:

Q.1 Is A/D vertical resolution high enough for the accuracy I want?

Q.2 What sampling freqeuncy would ideal be ideal for filtering as well as calulcation?

Q.3 What kind of filters should I use?

Q.4 Are there nay other ways of calulating phase difference with that high an accuracy?

Thanks in advance for any help you can provide.

-Karan Uppal
Dear Karan

I am ony able to partialy answer your question "Q.3 What kind of filters should
I use?"

I would suggest to use notch(bandpass) filter to get rid of the most of the
noise and then apply any of the techniques you are using. Hopefuly, this would
improve the phase error detection.

Kind Regards
Anser

________________________________
From: "k...@gmail.com"
To: m...
Sent: Fri, 14 January, 2011 10:33:31
Subject: [matlab] High Accuracy Phase calculation between two sine waves -
MATLAB

 
Hi,

I am trying to find the phase difference between two sine waves using matlab to
an accuracy of 4 decimal places. That means I want to be able to detect a phase
difference as small as 1e-4 radians. I am using a 12bit A/D. Both signals are of
the same frequency(50Hz), and the SNR is 2:1(yes, its a high noise environment).
I have tried many different ways but cant get an accuracy of more than 2 decimal
places. Some methods I have tried are -:

1. I have tried to find the zerocrossing and hence detect the time difference to
find the phase but doesn't work for high accuracy.

2.I have also tried to find the cross-correlation of the two signals and detect
the max time lag at the peak. This method give me a 3 decimal accuracy but still
not good enough.
For the these two methods I used a high sampling frequencies like 50KHz 500Khz
1MHz and 100Mhz. The last one gave me the best results which is understandable
as the closer the samples the more accurate they will be but at that high a
sampling frequency designing filters for a 50Hz signal with 500 to 5Khz range of
noise is hard, almost impossible in matlab. I am not sure what filter to use
there.
3. I also tried sina*sinb, the product to sum rule. I took the time avg. of the
resulting wave to eliminate the time varying component and tried taking the
arccos of the DC component that contained teh phase information.

4. I also tried sina+sinb, the sum to product rule and then took the magnitude
to calculate the phase difference.
The problem I faced with the above two methods is that the arccosine function is
extremely sensitive and hence the accuracy is there but the stability is not due
to noise.

For the above described problem I have a the following questions -:

Q.1 Is A/D vertical resolution high enough for the accuracy I want?

Q.2 What sampling freqeuncy would ideal be ideal for filtering as well as
calulcation?

Q.3 What kind of filters should I use?

Q.4 Are there nay other ways of calulating phase difference with that high an
accuracy?

Thanks in advance for any help you can provide.

-Karan Uppal