LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Signal Processing - FFT

Hello; a couple of us are working on developing code using the FFT and are noticing some discrepancies in what we are expecting in output.  I have attached the VI we are using (and made sure all supporting VIs are present)... we are using LabVIEW 2020.

 

Basically, everything can be accessed via the topmost VI, "Test15 (Multi Tone - Multi Signal).vi".  In a nutshell, we input a multi frequency sine tone (various frequencies from 5Hz though 3400Hz) to a UUT.  This part is working well.  Signal appears at the board, with the correct levels, etc.  This is not the issue.  The board digitizes the data nd sends it to a framegrabber, which further analyses the data, and send it out on several ports..

 

The VI "Get_Framegrabber_Data.vi" sets up the varios ports, and acquires the digital data into a 2D array.  You will notice two options for sampling rate: one is calculated using the HRRS.vi method, and the other allows a hardcoded sample rate of 7500 Hz.  The two are very close to produce a similar dt.  And yes, I am aware of the Windows limitation at > 1kHz, so there may be some play there, but we believe we have taken that into account (not shown here).  So, net output is raw framegrabber data.  Seems to work fine, unless there's a bug that I am not aware of.  It grabs the data and produces it into the 2D array.

 

Next is the "Process Framegrabber_Data.vi".  I don't totally understand the math here, but our engineers have been over this with a fine-toothed comb and seem to be happy with it.  To the extend of my knowledge, it takes the 2's complement of the data from the Framegrabber Data Array, and stores each channel (COS, SIN, OMNI, COMPASS) into a separate array to be used later.

 

Finally, we get to the "Format_Framegrabber_Data.vi"  This is where the fun seems to start.  Looking at the block diagram, my colleague has placed an array Max/Min to determine the full scale swing of the data.  The results were 1, -1, which were expected.  So far, so good.  Feed that data into the "Calculated_Caveraged_FFT.vi".  Expected results become a bit different.  We find that the Maximum output after the FFT windws up being (after dB Conversion) approx -10dB, wheras when we input a raw value of "1", we expect an output of "0".  Using the "FFT Spectrum (Mag-Phase).vi produces yet slightly different results at about -7dB.

 

Our question is: What are we doing wrong?  We have been at this for a while now, and are at the point where we are not sure where to go from here.  Are we processing the FFT's incorrectly?  Are we using the wrong VI's for our intent?  We are both sure we are doing something a little messed up, and hoping someone here can put us back on the straight and narrow!  Any inout or questions you may have would be greatly appreciated!

 

Thanks in advance!

 

 

 

0 Kudos
Message 1 of 4
(1,227 Views)

Hopefully, I will be able to look at the code later, but here are some immediate suggestions:

1. Look at the dB reference for your FFTs. I suspect one of them is using the expected level of the tones. One is probably using a reference of 1 V pk, and the LabVIEW FFT Spectrum (Mag-Phase).vi is using 1 V rms.

 

2. Try inputting a simple sine wave into your FFT VIs. Verify that you are seeing expected results (or adjust expectations).

 

3. There are lots of conversions that can be performed on FFT spectra. I suspect all implementations are correct, and they are outputting equivalent versions of the spectrum.

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 2 of 4
(1,162 Views)

Looked at the code. That's a lot of code. It would definitely be a help next time to just get the subVI that you have questions about or even a test VI that shows the difference between implementations for a given input.

 

From your code, it looks like you might not be comparing apples to apples. I see a calculation of Frequency Response, FFT Magnitude, Power Spectrum, FFT (low-level transform). 

 

Frequency Response(f) = Output(f) / Input(f)

 

whereas 

Power Spectrum = (FFT Magnitude)^2

 

The low-level FFT is computed without applying a window, but a Flat Top window is applied in the other calculations.

 

You can convert any of these spectra to dB.

 

Frequency response is different than FFT spectrum.

 

I can see the following results with these implementations on a simple sine waveform (frequency = 10, amplitude = 0.65):

 

(It looks like my screenshots did not embed properly, so I attached them as well)

 

 

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
Download All
0 Kudos
Message 3 of 4
(1,140 Views)

You can find additional reference for each VI in the context help for that VI. Reference help for frequency analysis in LabVIEW can be found here:  LabVIEW Help>>Fundamentals>>Signal Processing and Analysis>>Frequency Analysis

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 4 of 4
(1,134 Views)