Prev: CFP: The 2010 International Conference on Data Mining (DMIN'10), USA, July 2010
Next: FFTW Power Spectrum
From: Greg Heath on 7 Feb 2010 15:52 On Feb 5, 1:38 pm, "foxcob" <jacob.the...(a)gmail.com> wrote: > >All > > >This might have been discussed multiple times. However, I am new comer > to > >the site. > > >My question is given below. I wanted to put plots but could not find the > >way to do it. > > >I took a sine curve from 0-1 s( 1Hz)and 'fft'ed it in MATLAB. I get unit > >magnitude at 1 Hz as expected. Sampling rate 1024. > > >Then I zero padded it till 2 sec. So, total lines = 2048. The fft then > >showed major peak(0.5 magnitude) at 2 Hz with other higher frequencies > >present. > > >All articles on zero padding say that, zero padding does not add more > >information but just makes existing information more fine. Going by > that, > >the fft in second case should also have shown peak at 1 Hz. May I know > >where did I go wrong? > > >In Summary, should there be a difference in the usual sine wave and zero > >padded sine wave with respect to frequency spectrum? > > >Thanks > > >Rahul > > I believe what you are seeing is the Gibbs phenomenon. When you pad the > input with zeros, you are creating an edge or transition where the sine > wave stops. This transition contains harmonics of the 1Hz sine wave you > sampled. Not in this case where a periodic function is uniformly sampled over an integral number of periods. Hope this helps. Greg
From: Fred Marshall on 8 Feb 2010 01:02 Fred Marshall wrote: I should have added: Under more general conditions, and assuming adequate sample rate, then all of the information is preserved and temporal zero padding works to interpolate the frequency domain with redundant samples. So, if we're talking about the continuous Fourier Transform then this works just fine as the extents are infinite or at least finite over a single or multiple periods of a periodic waveform. And, the interpolation is nice but not necessary for such things as reconstruction. Of course, when one uses a rectangular window or gate function then it introduces high frequency components which then suggests that the sampling frequency is inadequate - because of the introduction of those higher frequency components. It's interesting that because we're fairly well forced to use a window of some sort that this aspect is often ignored - while other aspects are more highly emphasized. It's as if it's *IMPORTANT* to sample at Fs>2B and then blithely impose a finite window on the data. :-) Fred
From: Greg Heath on 8 Feb 2010 09:04 On Feb 8, 7:12 am, "rsk" <kalera...(a)yahoo.com> wrote: > >Fred Marshall wrote: > > >I should have added: > > >Under more general conditions, and assuming adequate sample rate, then > >all of the information is preserved and temporal zero padding works to > >interpolate the frequency domain with redundant samples. > > >So, if we're talking about the continuous Fourier Transform then this > >works just fine as the extents are infinite or at least finite over a > >single or multiple periods of a periodic waveform. And, the > >interpolation is nice but not necessary for such things as > reconstruction. > > >Of course, when one uses a rectangular window or gate function then it > >introduces high frequency components which then suggests that the > >sampling frequency is inadequate - because of the introduction of those > >higher frequency components. > > >It's interesting that because we're fairly well forced to use a window > >of some sort that this aspect is often ignored - while other aspects are > >more highly emphasized. It's as if it's *IMPORTANT* to sample at Fs>2B > >and then blithely impose a finite window on the data. :-) > > >Fred > > Just the last question, if the Sine and zero padded Sine are different > because the former being multiplied by a rectangular window in the time to > get the later, wouldn't it be improper to zero-pad a data that is acquired > on field? The data contains 700 samples and if I zero pad it to go to the > 1024 mark(for fft to be fast), my concern is that I will be introducing > additional frequencies(leakages) by this. > > I asked this because there is a field problem for which vibration data has > been collected and the test person has given me data with only 700 samples. > If I just 'FFT' it and if I 'FFT' it with adding zero's upto 1024, I would > get data at additional frequencies which, if I input to my computer > simulation model, would give me wrong response at those frequencies which > have been introduced due to zero padding. Replace "wrong" with "an interpolation estimated " > Any comments? I'd like to ask the experts: Why not just periodically extend the 700 samples to 1400 or 2100 . I'm not worried about powers of 2, just a "cleaner" interpolation. Hope this helps. Greg
From: dbd on 8 Feb 2010 13:45 On Feb 7, 8:35 pm, "rsk" <kalera...(a)yahoo.com> wrote: > > Thanks to all those who replied. Some replies are very much in detail and > special thanks to them. All replies are very useful. > > Rahul I've updated my Matlab code to work with a sine wave of intger and noninteger number of cycles in the window. It generates time and frequency domain plots of the windowed signal and zero-extended forms. Example figures and the code can be downloaded from: Zfill-fig1.jpg Time domain 4 Hz 32 points, 2x zero extension http://www.adrive.com/public/faa4bd6143a51531ec021963af9fe26910e27be47c31be0c3227cfd1613565b2.html Zfill-fig2.jpg Frequency domain 4 Hz 32 points and zero extended 64 points http://www.adrive.com/public/cc5a8f2d06913cd29376f35835c28002d844f4b0d5ad0029363c3c18ec06f7b7.html Zfill-fig3.jpg Frequency domain 4 Hz 32 points and zero extended x2, x4, x16 http://www.adrive.com/public/c568ac22e0b0a731ff454827e8520d573c1cef28760ffbb344a96557d937954a.html Zfill-fig4.jpg Time domain 4.5 Hz 32 points, 2x zero extension http://www.adrive.com/public/8aaec5ba266ea37840bb1d5e02a1ec3aefe915e4cbae248f0aeaf8285cb1182a.html Zfill-fig5.jpg Frequency domain 4.5 Hz 32 points and zero extended 64 points http://www.adrive.com/public/3d9842e645be32409f66baec78214dbaf5ee5ac2b3bf8f9e46ce8f9ae08dc44a.html Zfill-fig6.jpg Frequency domain 4.5 Hz 32 points and zero extended x2, x4, x16 http://www.adrive.com/public/fab41a6a93400652f23b15db686c50826780fb897dbed18930e0ffccd1fb53b7.html Matlab file zfill.m http://www.adrive.com/public/e8fce62f71ac1bb652f37d6f97f1c7cec0753bf68e39ca52dd35bc4e1dc740c1.html Dale B. Dalrymple
From: dbd on 8 Feb 2010 15:05
On Feb 8, 6:04 am, Greg Heath <he...(a)alumni.brown.edu> wrote: >... > > Why not just periodically extend the 700 samples to 1400 > or 2100 . I'm not worried about powers of 2, just a "cleaner" > interpolation. > > Hope this helps. > > Greg Zero-extending by an integer multiple of the original sample count simply assures that the new frequency domain sample set includes the samples obtained from transforming just the original sample set. You might consider this a 'cleaner' interpolation. Whatever the zero- extension, the signal and the window are the same so the response is the same, it just gets sampled at different frequencies determined by the transform sizes. Periodic extension is a theoretical construct that is only implemented if the signal in the sample set is stationary and periodic in the sample set. If so, the new sample set represents the original signal with a longer window with a narrower response about each component in the frequency domain. With real world data, how do you perform periodic extension? You can't get better results by just repeating the data set unless the signal is stationary and periodic in the sample set. As an example, last year I attended a lecture by a researcher studying dolphins. She separated multiple calls by detecting and tracking multiple FM sweeps.( Each call an FM sweep.) She used 1024 sample blocks of 44100 Hz sampled data from days long sample sets.The duration of individual calls was much longer than the sample blocks. Any energy that was stationary and periodic was interference. If you do have signals that consist only of components that are periodic in the sample set, it serves no purpose to 'extend' the data set without additional samples because the fft of the original data set will produce samples only at the frequencies of the possible periodic components. There will be no 'leakage' if the periodic assumption is valid because the response of the rectangular window (a sinc function) convolved with the signal components will have zeros at all other frequency samples. This is also the motivation for techniques such as synchronous sampling: choose to sample so that the assumption is valid for the signals of interest. If you have synchronously sampled, you can synchronously average to get signal processing gain against noise and interference that aren't synchronous to your samples. In this case you average multiple sample sets before the fft and reduce fft size and processing load. Dale B. Dalrymple |