LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to measure the phase of a sinusoidal signal?

I need to measure the frequency and the phase of a sinusoidal signal. I tried to use the Advanced Single Tone Measurements.vi but the phase measured in each iteration (each second) keeps changing (the measured frequency is not in integral Hz, so the first point of the next iteration is at a location different from the location of the first point of the current iteration...I guess this is the reason). How can really measure the phase of a signal (not always changing with time)? When I change the phase of the input sinusoidal signal, the measured phase should be changed though.

 

I'm using LabVIEW 7.1 and PCI-6110.

 

Thank you very much!

 

Marlon

0 Kudos
Message 1 of 13
(6,536 Views)
Marlon,

Phase is measured with respect to some reference. Mathematically, for a signal y = sin(2*pi*f*t + theta) the phase is measured with respect to the time t = 0. It can be another signal or a trigger. What is the reference in your system? Once you have defined the reference, then someone can help determine the best approach to measuring the phase.

Lynn
0 Kudos
Message 2 of 13
(6,521 Views)

Hi, Lynn:

I may say the reference in my system is time t = 0. Thank you!

0 Kudos
Message 3 of 13
(6,515 Views)
Marlon,

OK. So then is the problem that successive acquisitions are not continuous with the first one or the phase measurement does not know when t = 0 was?

If you can post your VI along with some typical data (we don't have your hardware), it will be much easier to see what is going on.

Lynn
0 Kudos
Message 4 of 13
(6,510 Views)
Hi, Lynn:
 
Here is an example. When I run it, the measured phase changes every iteration/second. So, the problem is that successive acquisitions are not continuous, right? How to solve this problem?
BTW, as for the "Wait (ms)" VI in the example VI, no matter what number I set, e.g., 50 ms or 100 ms, the data acquisition and calculation can only be done once per second. I guess this is decided by the sampling time setup of the AI nad the AO signals (the "Wait (ms)" VI can't work here), right?
 
Thank you!
0 Kudos
Message 5 of 13
(6,499 Views)
BTW, if using this vi, the phase measurement is good and the wait.vi works. Could you please tell me why? Thank you!
0 Kudos
Message 6 of 13
(6,496 Views)

In my application, I have a steel cantilever beam with a shaker contacts it at the the clamped side and a sensor at the tip of the beam. I send an analog output sinusoidal signal (A1, F1 and P1) to a shaker and measure the vibration of the beam at the sensor location by obtaining the analog input sinusoidal signal (A1', F1' and P1'). The P1' should be almost fixed in one run.

However, I just realized that the analog output (AO) sinusoidal signal is not continuous (from the vibration sound). For each iteration (about one second) the AO signals are not continuous. I think this is the reason for the phase measurement problem. If this is, then, how to generate a continuous analog output (AO) sinusoidal signal here?

Thank you! 

0 Kudos
Message 7 of 13
(6,479 Views)
Marlon,

Without DAQ hardware I cannot run your VI. DAQmx is not supported on my platform (Mac OS X), so I cannot examine your VI in detail.

1. The AI VI will wait until it has the amount of data specified. So if you are collecting one second's worth of data at a time, it will wait one second before completing. The 50 ms Wait will run in parallel, so it has no effect on the timing in this case.
2. Continuous AO is possible, depending on the hardware you have. However, I have no experience with implementing it. Since your frequency is such that you do not end the AO data segment at the end of a signal cycle, you need to be careful to avoid discontinuities in the signal sent to the AO.
3. There is no data dependency between the AI and the AO. It is possible that the AO could run after the AI in any given iteration of the loop.
4. Your phase reference should be the excitation signal. The best method of evaluating the response of the beam would be to use two sensors, one at the shaker and one at the tip. Then measure the phase shift of the signal at the tip with respect to the shaker signal. If two sensors cannot be used, either measure the voltage sent to the shaker or use the simulated signal that you send to the AO as the reference. In either case you would need to compensate for the response of the shaker.
5. Consider the phase shift in the filter. The steady state phase shift is about 14 degrees. The initial transient lasts about 5 cycles of the input waveform.
6. Your simulation sampling rate is 1000 samples/second. While this satisfies the Nyquist criterion for a 379 Hz signal, it does not give you much data to work with for the phase information. If the hardware will handle it, I would go to 10000 samples/second.

Lynn
0 Kudos
Message 8 of 13
(6,457 Views)
To generate a continuous analog output (AO) sinusoidal signal, I need to use a trigger, right? If I use a internal trigger (PFI0 as the trigger source), do I need to connect the PFI0 pin to sth.? I don't know how to connect the hardware. Thank you!  
0 Kudos
Message 9 of 13
(6,444 Views)

HI,

It is not necessary to have a triggered output to generate an analog out. This can be seen in the example Cont Gen Voltage Wfm-Int Clk.vi which can be found in the NI Example Finder. TO open the NI-Example simply select help>>find examples… once the example finder is open browse to Hardware Input and Output>>DAQmx>>Analog Generation>>Voltage. I hope this helps clear things up. Please post back with any other specific questions that you may have.

JaceD
Signal Sources Product Support Engineer
National Instruments
0 Kudos
Message 10 of 13
(6,419 Views)