From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT using LabView

Hello AlI,

I wish to compute the FFT of an analog signal using LabVIEW in real-time. I will feed the DAQ an analog non-sinusoidal waveform and have it compute the FFT to determine the magnitude of the frequency components up to the n-th harmonic. Of the FFT blocks available, which one will help achieve the best results? Also, are there any examples that I can follow along with?

Thanks in advance.

0 Kudos
Message 1 of 4
(3,410 Views)

If you open the NI Example Finder (in LabVIEW, it's under 'Help>Example Finder...') the 'Browse>According To Task' panel's first entry is 'Analysis, Signal Processing and Mathematics', under which you can find 'FFT and Frequency Analysis'. Several of these look like they might be helpful for you - some might even be useful to copy.

 

As to the FFT blocks, the 'FFT' block under 'Signal Processing > Transforms' on the block diagram palettes looks promising, but if you want to directly wire a waveform output from the DAQmx acquisition, you might have an easier time with the 'FFT Power Spectrum and PSD' VI found in the 'Signal Processing > Wfm Measure' palette. The detailed help files (either right-click the VI and select Help, or with the context help window open, click 'Detailed Help') are pretty informative about both of these VIs, and a comparison of different FFT VIs can be found via the link at the bottom of the detailed help for the FFT VI (the link is labelled 'Output units for FFT-Based VIs'.

 


GCentral
Message 2 of 4
(3,392 Views)

Thank you for the help! I have found some really good information. Another quick question if you don't mind:

 

I also need an analog output containing all the harmonics minus the fundamental (I will be needing this signal as a reference signal for a controller I am designing). Will the DAQ board/software allow me to perform such a task? I have done something similar before creating a step response in the software and using the analog output to observe on an oscilloscope, but I am not sure whether or not I can read an analog input and output an analog signal simultaneously in the same program. This may sound like a trivial question, but I started using LabVIEW only a few weeks ago. Thanks in advance!

0 Kudos
Message 3 of 4
(3,371 Views)

No problem!

 


@alexponce wrote:

Another quick question if you don't mind:

 I am not sure whether or not I can read an analog input and output an analog signal simultaneously in the same program.


Certainly LabVIEW won't prevent you from doing this - you can definitely write code to read inputs and write outputs simultaneously.

I don't know that every DAQ board will support this, but you should be able to find out via the manual for your specific hardware or alternatively, you can just write something to your output, connect it directly to the input, and then read the input. If you're happy with the simultaneity of that result, you're probably set! (Although it will be a little later in the case you actually describe, since you'll need to read, calculate, write. Probably not a problem though?)

 


 


GCentral
Message 4 of 4
(3,365 Views)