LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I take a Fourier Transform of data acquired over a long duration?

Solved!
Go to solution

Hi,

 

I'm try to set up Labview such that my data will be gathered over 10ish minutes and then have it process all of the data into a Fourier Transform. I know that the Spectral Power Measurement 'tool' allows for FFT but my current attempts seem to have LabVIEW only taking in a limited time duration worth of measurements. Would it be possible to achieve my goal without having to resort to saving the data as I go and then compiling and analyzing separately?

0 Kudos
Message 1 of 16
(5,508 Views)

Hi Sam,

 

I would need to know what format your data is in to help you further, but I would look into getting into the "analog waveform" data type.  That is a cluster of various parameters, and all pertinent functions reside in the Programming->Waveform palatte.

Once you have your data in this format, there is a nifty little FFT Spectrum subVI located in Programming->Waveform->Analog Wfm->Measurements palette.  Alternately, there is a FFT Power Spectrum in the same place which will return (true to its name) the power spectrum of the signal.

I believe these subVIs will work with signals of any length, so your ~10-minute signal shouldn't be a problem.

 

Read the help and dig through the examples regarding those functions and you should be good.

-Jim B
Applications Engineer, National Instruments
CLD, CTD
Message 2 of 16
(5,464 Views)

Some points to consider:

 

1) Number of samples in your FFT is sampling rate * time

2) Sampling rate has to be greater than 2x the highest frequency component in your signal

3) 10 minutes will most likely result in a signal that cantains too many samples to be processed using the FFT

4) if you are filtering the signal, then break it down into smaller blocks of samples of length power of 2.

 

 

Message 3 of 16
(5,457 Views)

Breaking the signal down seems to be the best solution. As I've been able to get Spectral Power Measurement blah blah creating FFT data of almost immediate signals but for the amount of data points that I need to acquire it is likely that the FFT is overrun with data (Since I'm working with light the frequency range is exteremely high but some of the inherent stablility issues are typically found closer to 50Hz (In most cases which is why I have to take a 10 minute measurement)).

 

So if it is beyond the FFT program to process all of the sampling points should I turn the data into two second array bundles and then save that and when I'm finished 'stitch' them together to be analyzed by some more powerful FFT software (I'm sure I might be able to find it) or is there a better solution you can think of?

0 Kudos
Message 4 of 16
(5,449 Views)

Sam,

 

Can you give us the relevant numbers? Sampling rate? Frequency range of spectral features which you want to detect/measure? Required frequency resolution? Signal to Noise ratio? How fast can the frequency of some of the desired signals change? How fast can the signal amplitudes change?  What will you do with the spectral information after you get it?

 

Lynn

Message 5 of 16
(5,446 Views)

Sampling rate: 1,024 Samples per Second

Frequency Range of Spectral Features: 500Hz>=f>=50Hz (There may be more features lower than 50Hz but it is expected that they won't be dominant, alternately if some lower frequencies are shown to be dominant another run will be down in the interest of lower frequency signals)

Signal to Noise Ratio: 1,000:1

Frequency can change in potentially attoseconds but realistically most changes within the system will occurs at microseconds.

Spectral information is only to get a good idea of intertable stability (the tables are floating and we are the instability of the frequency displayed in a single fringe from a Michelson interferometer as a guide) to determine whether it is worth obtaining fast steering mirrors for the set-up.

 

0 Kudos
Message 6 of 16
(5,437 Views)

That is helpful.  I will do some calculations later and get back to you with my suggestions.

 

Lynn

Message 7 of 16
(5,430 Views)

Sam,

 

1. How can the table move even a fraction of a wavelength of light in attoseconds, or even microseconds? At any rate you certainly cannot detect any change faster than the sampling period ~1 ms.

 

2. At 1024 S/s one hour (longer than "10ish minutes) of acquisition will generate 3,686,400 samples. The standard FFT VI in LabVIEW can process that amount of data in < 1 second (~690 ms on my computer).

 

3. The frequency resolution, df, is fs/N where fs is the sampling frequency and N is the number of samples. For a 1 hour acquisition df = 0.278 mHz. For a 1 second acquisition df = 1 Hz.

 

4. If the frequency changes over the duration of the acquisition, the FFT will show multiple peaks or a broadened peak depending on whether the frequency changes abruptly or smoothly and on how large the frequency change is.

 

The example attached generates several types of signals and calculates the FFT. This is not particularly careful about memory use and will generate out of memory errors if the number of samples gets much larger than the 3.7 million samples you would collect in an hour.

 

Your original question seemed to be about acquiring or accumulating data rather than FFT. Is your problem the way you are accumulating the data? Pre-allocating the space for the data is much more efficient than repeatedly re-allocating while the VI is running.

 

Lynn

Message 8 of 16
(5,409 Views)

1) It's not the table it's the laser which can change but I'm not too worried about that.

 

2 & 3) Good to know. 😄

 

4) That's pretty much how I was expecting to see any 'instability'.

 

The original question is more on the money with my problems. I seem to the FFT working fine it was more getting the data to the stage that it could be analyzed by the FFT that seemed to be the issue as it was having troubles analyze very low frequency signals (which I'd made a few artificial signals to test) as it only seemed to be picking up on the first few seconds of signal and then ignoring the rest of the signal. I'm not quite why this is. How would I pre-allocate the space for the data? Also many thanks.

0 Kudos
Message 9 of 16
(5,400 Views)

Use 'initialise array' to preallocate the required number of samples. Then using a shift register to pass this array through your acquisition loop, use 'replace array subset' to insert the data blocks into the array.

 

Still have no clue what you mean when you're talking about sampling data up to 'light frequencies'.

0 Kudos
Message 10 of 16
(5,375 Views)