LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT Spectral leakage and uniform white noise

Environment:

LabVIEW 7.0

 

Express VI -Simulate Signal

Express VI -Spectral Measurements

 

If the number of data elements sent into the Express VI -Spectral Measurements is not an even power of 2. Will the Express VI -Spectral Measurements internally apply zero padding to the next higher power of 2 (e.g. 100 samples is padded up to 256)?

 

The white paper “LabVIEW Analysis Concepts” states on page 2-12 that “zero padding also helps in improving the frequency resolution by increasing the number of samples”. This can’t be correct; padding zeros doesn’t increase the amount of information. If that was the case I could take 10 samples and pad 4086 zeros and get very fast accurate measurements.

 

 

FFT Spectral leakage and window functions:

I have studied the tutorials and examples and tried the various window functions on simple sine waves with the Express VI -Simulate Signal. It works like I expect it to on a pure sine wave, but if I add uniform white noise (which gives a signal that’s a little bit more realistic) I don’t understand the result.

Why is the amplitude in the power spectrum changing almost more if I apply a Flat Top Window than if I have no Window at all? How does the spectral leakage behave for uniform white noise?

 

Kind regards

0 Kudos
Message 1 of 9
(5,282 Views)
Yes, zero padding can dramatically inprove the frequency resolution if applied correctly. Trust me.
 
The attached image shows two typical result for a DEER measurements (double electron-electron resonance). For various reasons it is very expensive (or even impossible) to collect data out to longer times, and, as you can see, the signal washes out pretty quickly for longer times. Filling with zeroes does not change the data.
 
You can also see that the main components are probably not exact integer multiples of the sampling interval. If you would take an fft directly, you'll get the DC component and a few main AC compenents, and the transformed spectrum consists of only very few point in the interesting part. The first AC point in the transform corresponds to a single sine period over the sampling interval. the second point to two periods, etc. A component that would have e.g. 2.5 periods cannot be shown and would leak into the second and third AC component.
 
The lower image shows all the details you get if you would zero fill the data to 8k points (~20x the original range). Notice that we zoomed into the DC centered part and only show a very small fraction of the spectrum. Now we can see all the frequencies that actually exist, not only the ones that have an integer number of waves over the original sampling inteval. Without zero padding, you'll get only about three or four points covering the interesting part of the spectrum. Not enough resolution!
 
 

Message Edited by altenbach on 10-31-2005 09:00 AM

0 Kudos
Message 2 of 9
(5,265 Views)

As the Online Help says...


This Express VI uses the functionality of the following VIs and functions:

FFT Power Spectrum
FFT Spectrum (Real-Im)
FFT Power Spectral Density

1. By the way I think no zero padding is applied, infact if you have a signal with 1000 samples the express vi yelds a fft trasform with 500 samples, not 512 that you would have in case of zero padding. And remember: zeropadding in time domain means interpolating in frequency domain and viceversa.

2. I think there's a misunderstanding. It's unlikely to find such an absurdity on a NI document. Obviously zeros don't have the power to add information...

3. I didn't understand well your question: windowing helps to reduce  the "spectrum spreading" effect that takes place when a signal have different values at boundaries; what do you mean for "amplitude in the power spectrum changing"? Are you doing averaging?

Regards,
manga

0 Kudos
Message 3 of 9
(5,258 Views)
Zero padding of course works both ways. Imagine you have a frequency spectrum with two points. If you transform it back to the time domain, you get two points that define your sine, and you cannot distinguish it from e.g. a triangle wave of the same frequency.
 
If you would zero pad your spectrum to 1k point and do the transform, you'll get a single period of a perfect sine function with 1k points. Adding zeroes simply forced the extra information that there are no higher frequencies. You can think of zero padding in the frequency domain as an interpolation in the time domain.
 
Remember when CD players first came out there was all that marketing hype about 4x or 8x oversampling? It did not add to the original music information but simply pushed the nyquist frequency to a much higher value so it could be filterered without affecting the audio range. 🙂 It made a big difference!
Message 4 of 9
(5,256 Views)

Dear Altenbach,

 

In the case with the DEER signal I can understand that you can fill out the data set with zeros at the end, since the signal washes out, the likelihood for the signals to actually being zero is very high.

Is the red and white curves in your graph two different measurements, both zero padded?

 

But if the signal is of a more "random" character and you can not predict how the extension of the signal will look like; Then I still don't understand how padding zeros can increase the resolution. If I interpolate points between actual data points in the time domain I make an assumption, but I don’t know, that there is no "fast changing data" in between.

 

In your example with padding zeros in the frequency domain, it assumes that you have the knowledge that no higher frequency component exists in the signal. But if you don't know if higher frequency components exist?

 

I'm still confused.

 

0 Kudos
Message 5 of 9
(5,231 Views)

Dear Manga,

 

2. I'm just reading what NI has printed in the document “LabVIEW Analysis Concepts” page 2-12.

 

3. Let me clarify my question:

Assume that you enter a pure sine wave with a frequency of 50 Hz and an amplitude of 1. Run an FFT without window function. The power spectrum now shows a sharp peak with the amplitude of 1. If you alter the frequency to 53 Hz the power spectrum peak is now lower in height and more blunt, the energy has leaked into other frequency bins.

If I apply a Flat Top window the height of the peak in the power spectrum stays more or less the same regardless if the frequency is 50 or 53 Hz.

If I do continuously FFT's and study the Power Spectrum, when I change the frequency, I can see the peak slide up and down the x-axis (frequency) while the amplitude is going up and down, in the case when I have no window function applied. If I have Flat Top applied I can the peak (in this case wider) slide up and down the x-axis but the peak amplitude stays the same.

 

When I add some white noise on top up the pure sine signal to create a more "real world signal", something happens that I don't expect.

When I study the power spectrum, that is continuously updated, I see the Flat Top window response now changes up and down in amplitude almost as much as the Power spectrum without any window function. Why is that? Why isn't the Flat Top amplitude more stable for this type of signal?

 

Thank you both for helping me shed some light on these topics.

0 Kudos
Message 6 of 9
(5,229 Views)
Hi wiz,

2. I didn't find the document you're talking about but I believe you; anyway on NI website you can find also http://zone.ni.com/devzone/conceptd.nsf/webmain/81227DF4C2952C1A86256CA80053F322

3. As I stated previously, windowing is useful when the end of the sample sequence is not "continuous" with the beginning, therefore imho no window can "stabillize" a peak that oscillate because of noise. The oscillation you observe isn't due to an "end-beginning discontinuity" but actually noise gives different frequency contributions at every cycle. When dealing with  noise only averaging can stabilize the spectrum.

I hope this helps (it's so hard for me talk about these things not using my mother language )
regards,
manga
0 Kudos
Message 7 of 9
(5,225 Views)


No math wiz wrote:

In the case with the DEER signal I can understand that you can fill out the data set with zeros at the end, since the signal washes out, the likelihood for the signals to actually being zero is very high.Is the red and white curves in your graph two different measurements, both zero padded?


The upper panel shows the raw data and the lower pane the DC centers fourier transform AFTER zero padding. Without zero padding, the pattern in the center would only contain a few data points.


But if the signal is of a more "random" character and you can not predict how the extension of the signal will look like; Then I still don't understand how padding zeros can increase the resolution. If I interpolate points between actual data points in the time domain I make an assumption, but I don’t know, that there is no "fast changing data" in between.

 

In your example with padding zeros in the frequency domain, it assumes that you have the knowledge that no higher frequency component exists in the signal. But if you don't know if higher frequency components exist?


You seem to confuse the meaning of the word "resolution". The word "resolution" does not imply any data quality or richness of information. It only tells you about the spacing of the points in this case.  You need to decide if zero padding is appropriate for your particular situation. It often is.


 

0 Kudos
Message 8 of 9
(5,212 Views)
There are two kinds of "resolution" in DSP.  One is physical resolution, which is determined by fs/L, where fs is sampling frequency, L is the number of samples you acquired.  The other is computational resolution, determined by fs/N, N is the number of points you used to do FFT. N might not be the same as L because of zero padding. Once you have finished your acquisition, the physical curve of the spectrum is determined, whatever method you use to compute it!  An N-point FFT is equivalent to sampling N points from the physical spectrum curve. So padding zeros doesn't create any information, only to get more points from the physical spectrum curve.  If you have acquired too few points, the physical spectrum curve might be wrong. In this case padding zeros only help you get more wrong points.  "padding zeros can improve frequency resolution" actually means "improve computational resolution", not physical resolution.
0 Kudos
Message 9 of 9
(5,199 Views)