LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Questioning logic in "Amplitude and Phase Spectrum.vi"

I am maintaining a LabVIEW v6.1 program originated by others. The program measures vibration and presents an analysis to the user. The analysis includes a Peak G value and an associated Frequency. I have questions regarding one of the LabVIEW VIs used in the program, about the logic in the VI and the way the results of the VI are used in the program.

The program acquires a buffer of acceleration values that represent the vibration over a period of time. It then extracts the maximum absolute value from the array and presents it as the Peak G. The array is then passed to the "Amplitude and Phase Spectrum.vi". The "Amp Spectrum Mag (Vrms)" array output of that VI is then passed to the "Array Max & Min" function block and the "max index" return is multiplied times the "df" return from the "Amplitude and Phase Spectrum.vi" to arrive at a value that is labeled Frequency (I am assuming that this is meant to be the frequency of the sine wave component with the largest magnitude).

First, I have questions regarding the logic in the "Amplitude and Phase Spectrum.vi". In the VI, the input Signal array is passed to the "Real FFT.vi" and the resulting array of complex values is converted to polar form. The radius component of the polar form is then put through a For Loop where the first half of the array values are multiplied by the square root of two and assembled into the output array "Amp Spectrum Mag (Vrms)". That is, all of the values except the first one (where For Loop index equals 0) are multiplied by the square root of two. The first value is simply passed through unmodified.
Why is the first value treated differently? Why is the second half of the array discarded?

Second, I have a question regarding the use of the results of the VI. Is my interpretation of what the program has labeled Frequency (the index of the maximum value in the "Amp Spectrum Mag (Vrms)" array multiplied by the "df" value) correct? I.e., does the index multiplied by "df" yield the frequency of the largest magnitude component?

I have attached the VI that contains the code described above. There is a global variable referenced in the VI called "DAQ Setting". It is a cluster that includes a value containing the scan rate (samples per second) used for the acquisition of the acceleration data. That value is inverted and passed to the "Amplitude and Phase Spectrum.vi" as the "dt" input.

Thank you for your help in understanding this program fragment.
0 Kudos
Message 1 of 3
(2,792 Views)
Ooops! I forgot to attach the VI. Here it is...
0 Kudos
Message 2 of 3
(2,791 Views)
The Amplitude and Phase Spectrum vi gives the one sided spectrum. The FFT gives a two sided spectrum ie positive and negative frequencies. The power (ie magnitude squared) at a particular frequency is the sum of the power of the positive and negaive frequencies. For a real valued time signal the corresponding positive and negative frequencies have the same power. So the power at a particular frequency = 2* power at positive frequency. Therefore amplitude=sqrt 2 * amplitude. So the vi is right.

Second half of the array can be discarded as they are the negative frequencies. The vi provides the "single-sided spectrum"

The first element is the DC component (ie the mean). The magnitude of the DC component from the FFT has been calculated and stays
as is to give the amplitude.

The index multiplied by df will give the correct frequency. Remember that the frequency coves a bin of size df.

Hope this helps. There are a few good articles on devzone about FFT analysis. However you are right to be careful about the internals of any vi's. Someone recently spotted a problem in one of the new signal processing express vi's.
0 Kudos
Message 3 of 3
(2,791 Views)