LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

powerspectrum temporal resolution

Hi,


I am calculating the Power Spectrum of a time domain signal using the FFT Power Specturm.vi. To aqcuire the time domain signal i use the AI acquire waveforms.vi. LabVIEW version 6.1. The timing settings of the AI Acquire waveforms.vi are 40000 and 40000. ==> 1 data point per second. The frequency range for the power spectrum then is 0 to 20000 Hz with a df of 1. and i get 1 spectrum per second.

Now the problem: I would like to acquire more, lets say 20 spectra per second without loosing the resolution of df =1. If i set the timing parameters of the AI Acquire waveforms.vi in a way that i get 20 datapoints per second the resolution of the power spectrum automatically goes down to 20.

Is there a way to get a spectrum from 0 to 20 kHz with a resolution of df =1 and 20 spectra per second or is resolution df allways reversely proportional to spectra per second?

Thanks for any help !

0 Kudos
Message 1 of 7
(3,376 Views)
Philipp,

the resolution of an FFT is always defined by the number of samples that you use for the FFT. This is defined by math and can't be changed.
If you want to calculate more FFTs/second without loosing resolution, you will have to use a moving window of your data.

Here is an example:
Sampling rate = 20000 Hz
# of samples to use per FFT = 20000
# of FFTs/second = 10

FFT1 uses 20000 new samples
FFT2 uses 18000 samples from FFT1 and 2000 new samples
FFT3 uses 18000 samples from FFT2 and 2000 new samples
.
.
.

This will keep the resolution high, but on the other hand older data is used as a base for the calculation. If this is not an option for your use case, the only thing that you can do is to increase the sampling rate, so you get more samples per time interval.
Please note, that the numbers in my example are just numbers that are easy to calculate. In fact an FFT works only with a number of samples that is a power of 2, so e. g. if you provide 20000 samples, only 16384 samples can be used for the calculation.

I hope this helps,

Jochen Klier
National Instruments

0 Kudos
Message 2 of 7
(3,358 Views)
Jochen,

According to the LV documentation any size array can be used as input to the Fourier transform functions. If the size is a power of 2 the highly efficient fast Fourier Transform algorithm is used. For some other sizes another fairly efficient algorithm is used. For irregular sizes a much less efficient algorithm is the only thing available.

From the FFT Fundamentals document:
"Fast FFT Sizes
When the size of the input sequence is a power of two, N = 2m, you can implement the computation of the DFT with approximately Nlog2(N) operations, which makes the calculation of the DFT much faster. DSP literature refers to the algorithms for faster DFT calculation as fast Fourier transforms (FFTs). Common input sequence sizes that are a power of two include 512, 1,024, and 2,048.

When the size of the input sequence is not a power of two but is factorable as the product of small prime numbers, the FFT-based VIs use a mixed radix Cooley-Tukey algorithm to efficiently compute the DFT of the input sequence. For example, Equation C defines an input sequence size N as the product of small prime numbers.

N = 2^m*3^k*5^j (C)
for m, k, j = 0, 1, 2, 3, …

For the input sequence size defined by Equation C, the FFT-based VIs can compute the DFT with speeds comparable to an FFT whose input sequence size is a power of two. Common input sequence sizes that are factorable as the product of small prime numbers include 480, 640, 1,000, and 2,000."

Do you have information which indicates that this is no longer valid?

Lynn
0 Kudos
Message 3 of 7
(3,345 Views)
Hi,

Thank you for the support. After rethinking the whole matter it became clear to me. I don´t think i want to use a moving window.

Thanks again

Philipp
0 Kudos
Message 4 of 7
(3,335 Views)
johnsold,

no, there is nothing wrong with the documentation of the power spectrum vi, so my knowledge here is obviously a little bit out of date Smiley Happy. Still using a power of 2 is much more efficient, than using other numbers, so this is the recommended option.

Jochen
0 Kudos
Message 5 of 7
(3,314 Views)
Hello again,

I would have another question about the Power Spectrum function. I changed the timing parameters of the incoming signal to increase the resolution of my spectrum. I did this because the spectrum was fluctuating a lot with respect to time. So i am still acquiring with 40000 samples per second but instead of 40000 samples i recorded 80000 1600000 etc. which increased the resolution (decreased df). In fact the spectum became steadier. But in addition something unexpected happened:
With increasing resolution the whole spectrum shifted to smaller absolute values. As far as my understanding goes this should not hapen . Do you have any idea what might be the reason for that. By the way, the time domain signal i am acquiring comes from an accelerometer and measures vibrations of a vessel.

Thanks for any help!
0 Kudos
Message 6 of 7
(3,303 Views)
Did you verify that the dt component of the input waveform to the FFT Power Spectrum.vi is correct for the changed sampling parameters?

If you attach your code with some typical data saved as default (we do not have your hardware or signal sources), someone will probably be able to tell what is happening.

Lynn
0 Kudos
Message 7 of 7
(3,301 Views)