ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Extract Single Tone Information to detect phase

Dear all,

 

I have problem using Extract Single Tone Information vi to detect phase angle of a sine wave. 

 

I posted similar question a few days ago regarding using the same vi to determine phase angle of a square wave and realised it couldn't be done because square wave is not single tone. I modified my program slightly and use it to examine a sine wave but I still couldn't get reliable results. 

 

Please find the attached for the program code. When I set frequency to 5 Hz, everything worked fine but when I set it to 5.17 Hz with 20 degree phase, the detected phase value keeps changing.  Appreciate if you could help me on this matter. Thank you very much!

 

Best regards

0 Kudos
Message 1 of 5
(4,208 Views)

Hi looloo,

      I've added a second chart to your VI to make it obvious what's happening.  The second chart shows the Y-array input to the "extract single tone function".  Phase - or starting-angle - changes periodically, when array-index output from Modulus-function  "wraps" back to zero.

 

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 5
(4,202 Views)

Hi tbd

 

Unfortunately I couldn't open your file as I am using LabVIEW 8.2. Do you mean that the sample size chosen is not appropriate?

 

Thanks

 

Best regards

 

0 Kudos
Message 3 of 5
(4,199 Views)

Hi looloo,

      Sorry for slow response!  Here's the VI back-saved to LV8.2

 

(in case It's not too late to help...) 

The "phase" output reflects the "angle" associated with the beginning value in the Y-array (when Y = amplitude, Phase is 90deg.)

Phase is changing because sine-wave (Y-input) is shifting each time single-tone is called...

 

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 4 of 5
(4,160 Views)
Did a little modification to looloo's code to correct phase change(by having fixed time input).  🙂
Message 5 of 5
(4,153 Views)