LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

phase measurement changing amplitude

Hello,
Attached vi generates a data stream with increasing amplitude. I am trying to find its amplitude using tone measurements.vi, spectral measurements, extract single tone, and phase spectrum.vi. I do not understand why I cannot get 0 phase and why these VIs give different answers.
 
Next I am trying to match this data stream by generating another signal using the phase,frequency and amplitude information obtained from the generated signal.
 
In real world, I have a data with changing amplitude and I am trying to generate another wave (sine wave, by using generate wave.vi) to match it so that I can find approximate phase values corresponding to each point in the real data. My questions:
 
1. Why is not there a vi showing 0 phase?
 
2. Is there a way to match the increasing amplitude data, maybe by using another parameter(rate of change of amplitude) in generate sine wave?
 
3. Or is there an other way of tagging phase angle values to the real data?
 
Thank you very much for your time.
0 Kudos
Message 1 of 5
(4,413 Views)
This may not answer all your questions, but I hope it helps get things started.

The VIs you used all take the FFT of the signal internally and the process the results in various ways. You can see this by opening the front panels (and then the diagrams) of the VIs. It is not clear to me as to what the Fourier transform of your signal should be. The transform of

t^n * x(t) is i^n * d^nF(w)/dw^n

The math does not show up well in a text document. The transform of t times x(t) is i times the derivative of the transform of x.

For your case x(t) is sin(2*w*t). The transform of a sine is the Dirac delta function. Further it is imaginary. It is not clear how the derivative of delta function is defined. So I am not sure what the expected result should be.

Second. Because the duration of the signal is finite, the Fourier transform actually calculates the convolution of the transform of the signal as if it ran forever and a square pulse of unit amplitude. This could account for some of the phase shifts.

Now to address your real world problem: Does the signal start at zero amplitude like your simulation? If so, how do you know when it started? Is there some kind of trigger signal available? How much time lag can you tolerate between the measured signal and the generated one? Does the frequency or phase change significantly during the process?

Lynn
0 Kudos
Message 2 of 5
(4,380 Views)
Hello Lynn,
 
Thank you for replying.
 
I am attaching the real data this time. First column is the trigger signal, and the second is the data. Trigger signal is where the value is aroud 3.5 (It is repeating around 30 times but the first one is the real trigger). 
 
My signal starts from 0 , but since I am only using the points(501) around the pulse amplitude is not zero. Frequency of the signal is  90 hz and it is changing about 10 hz, amplitude is also changing from time to time. These pulses are representing recording of images. I am grouping pulses (images) according to tagged phase angles. Each group is composed of 10 degree interval.
 
I am not sure how much lag is ok, but it is ok if they still fall in the same interval.
 
Thank you once more.
0 Kudos
Message 3 of 5
(4,374 Views)
I am not sure I understand correctly, but here is something I tried.

I saved your data to a control. I find the trigger by looking for the first data point with value greater than a threshold. I extract a subset of the data around the trigger (501 points starting 250 points before the trigger). I find all the rising zero crossings in that subset, convert the time data to frequency and generate a sinewave with the same average frequency and the amplitude equal to the maximum value in the subset and the same number of samples. (Number of cycles = frequency * sample period * number of samples). I find the phase difference by subtracting the first rising zero crossing in the data subset and the generated waveform. Then I extract a new subset of the original data shifted by the phase difference and plot the result in Waveform graph 2.

Building arrays inside loops is not good practice if you have large amounts of data. Initialize the array outside the loop and use Replace Array Subset and a shift register to avoid reallocating memory. For this small demo the performance hit is insignificant. The program is not optimized, but is intended to generate some alternative ideas.

Lynn
0 Kudos
Message 4 of 5
(4,361 Views)

Dear Lynn,

 

Thank you very much for your effort. Your VI definetely helped me to think different alternatives. I know you already spent a lot of time for me but I need the phase angle values at the trigger points.

 I tried implementing this in your vi by using tone measurements vi to get the phase values of the generated sine vi and later the correspponding trigger point, but it  still gave me a nonzero phase for the sine wave. Also no problem but I think it runs for one time only.

I am attaching a VI, I was working on. I know it is a very low performance and primitive VI, but any recommendation is welcome. My vi reads the pulse, and data then adds time and index information. Later when it detyects a trigger point it extracts 501 points like your vi. Then gets frequency, amplitude, phase values from tone measurements vi (where I got the error). Then using these values generates a sine wave and writes phase values for this wave. Last step is to save the phase values at the pulses. This vi repeats for all the pulses.

If you can tell me how to calculate phase values for each point I will really appreciate that.

 

Thank you once more.

 

Regards,

 

ilter

0 Kudos
Message 5 of 5
(4,341 Views)