# Tag Info

31

There are a few things to consider before you decide to zero pad your time-domain signal. You may not need to zero pad the signal at all! 1) Lengthen the time-domain data (not zero padding) to get better resolution in the frequency domain. 2) Increase the number of FFT points beyond your time-domain signal length (zero padding) if you would like to see ...

19

Resolution has a very specific definition in this context. It refers to your ability to resolve two separate tones at nearby frequencies. You have increased the sample rate of your spectrum estimate, but you haven't gained any ability to discriminate between two tones that might be at, for instance, 236 Hz and 237 Hz. Instead, they will "melt together" into ...

13

The term "resolution" has multiple meanings, which can confuse people trying to communicate when using two different meanings. In the optical sense, of being able to resolve two nearby clearly separated points (or two adjacent peaks in the spectrum) instead of one blurry blob, zero-padding won't help. This is the meaning most likely being used when ...

13

All that is happening when you zero-pad the input signal prior to a DFT, is that you are interpolating the frequency domain representation. For example, you might get a certain shape as the output of your absolute magnitude of the DFT, and this shape has 10 points. If you zero-padded the input of your DFT to say, 100 points, you will get the same shape as ...

9

Your problem is these two lines: t=(1:L)*(1/Fs); f=(1:L)*df; They should read: t=(0:L-1)*(1/Fs); f=(0:L-1)*df; If I modify your script as below (for scilab, not matlab), I get the following plot. The peaks all line up correctly. And the peak of the FFT is at 0.25 not 0.3125. for ZP=0:5 // of times of original length of signal to ZP with x=[...

8

The length N of the DFT is the number of frequency points that will result in the DFT output. Zero padding will result in more frequency samples, however this does not increase frequency resolution, it just interpolates samples in the DTFT. The frequency resolution is given by $1/T$ where T is the time length of your data (regardless of sampling rate). So ...

6

If one has any interest in the spectrum of the windowing function used to isolate the time-domain sample, then zero-padding WILL increase the frequency resolution of the windowing function. If the time signal is $x(t)w(t)$, where $w(t)$ is the windowing function, then the overall spectrum is $X(f) * W(f)$, where $*$ inidicates convolution. If your ...

5

All effects you see have to do with windowing. Your signal can be seen as a truncated (i.e., rectangularly windowed) sinusoid. If $s[n]$ is your signal, and $w[n]$ is the window, the signal you analyze is $$\tilde{s}[n]=w[n]\cdot s[n]\tag{1}$$ With the discrete-time Fourier transform (DTFT) defined by $$S(f)=\sum_{n=-\infty}^{\infty}s[n]e^{-j2\pi nf}\tag{... 5 I'd like to apply zero padding to it, for better frequency bin resolution. First of all, let's state it one more time that zero padding does not improve frequency resolution of DFT. It'll only interpolate the existing spectrum on a finer frequency grid, but will not add any new information to it, otherwise. In order to improve the true frequency resolution ... 4 Advantages of zero padding: If length of your sequence doesn't correspond to the size that can be handled efficiently with FFT routine (usually powers of prime numbers) then you might want to add some extra zeros to the nearest power in order to get the maximum speed-up. In worst case you double the memory you need for your signal. Adding zeros is equal to ... 4 It's actually possible to pre-multiply the signal with a complex exponential and thus shift the center frequencies of the FFT bins. Particular useful is multiplication that shifts by half a bin since it maintains complex conjugate symmetry for real valued time domain signals and you end up with N/2 complex at N/2 frequencies instead with N/2+1 frequencies ... 4 The result of a convolution of a data vector of length M with a kernel of length G is of length M + G - 1. (the maximum length of the non-zero portion, even though the limits of integration is sometimes written as from -infinity to +infinity) This is clearly (G - 1) elements longer than the original data vector. So where do these new, "extra", additional ... 4 The answer above is correct. Just to clarify a bit further, using x = np.linspace(0,10,5) will produce 5 numbers from 0 to 10 inclusively np.linspace(0,10,5) array([ 0. , 2.5, 5. , 7.5, 10. ]) You don't want the last number because in your example the last number is the first number of the next period. A correct implementation would be: periods = 4.*np.... 3 Zero padding in the time domain corresponds to interpolation in the frequency domain (and vice versa). The specific relationship is sync interpolation, sometimes also known as Whittaker-Shannon interpolation. http://en.wikipedia.org/wiki/Whittaker%E2%80%93Shannon_interpolation_formula In case of the FFT the linear integral/sum has to be replaced with a ... 3 Shifting the data points (fftshift) and zero-padding the exact center of the FFT aperture has the property that all the even (symmetric) components with reference to the center of the original data set end up in the real part of the complex FFT result, and all the odd components end up in the imaginary part. e.g. the evenness to oddness ratio is preserved, ... 3 I know this is old, but I thought I would add something here. You can smoothly blend the part the filtered and unfiltered segments with a gradual function such as a sinusoidal window function. That will make this a little more agnostic to the type of input function since it will retain the original, unprocessed function at the boundaries yet leave less ... 3 For a) you're correct. For b), x_1 is a length 2N signal, and its DFT is given by$$X_1[k]=\sum_{n=0}^{2N-1}x_1[n]e^{-j2\pi kn/2N}=\sum_{n=0}^{2N-1}x_1[n]e^{-j\pi kn/N}\tag{1}$$With x_1=x[n]+x[n-N] you get$$\begin{align}X_1[k]&=\sum_{n=0}^{N-1}x[n]e^{-j\pi kn/N}+\sum_{n=N}^{2N-1}x[n-N]e^{-j\pi kn/N}\\&=X\left(e^{j\pi k/N}\right)+\sum_{n=0}^...

3

The conventional definition of the DFT for a length $N$ signal (without zero-padding) is $$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}\tag{1}$$ So there is no scaling involved. Scaling is applied to the inverse DFT: $$x[n]=\frac{1}{N}\sum_{k=0}^{N-1}X[k]e^{j2\pi nk/N}\tag{2}$$ If you pad a length $N$ signal with $M$ zeros, the resulting DFT length is ...

3

so let's say the length of your FFT is $N$. let's say that you fill half of the buffer with your signal and fill the other half with zeros. $$x[n] = 0 \quad \text{ for } \tfrac{N}2 \le n < N$$ the DFT of $x[n]$ is $X[k]$. then magnitude-square and inverse DFT: $$R_x[n] = \mathcal{iDFT}\bigg\{ \bigg|X[k]\bigg|^2 \bigg\}$$ in the time domain, ...

3

Think about both questions separately. First of all, the (I)FFT is just an implementation of the (I)DFT, so I'm going to generalize all this to the DFT. Does the zero-padded IDFT retain variance? Parseval's theorem says power out = constant factor · power in, and the power of the zero-padded sequence is the energy of that sequence divided by it's length – ...

3

The math is well known; it is the convolution theorem for the DFT. In this specific case: $$DFT\left\{f[n]\cdot z[n]\right\} = DFT\left\{f[n]\right\} * DFT\left\{z[n]\right\}$$ Where: $f[n]$ denotes your original sequence of 128 samples $z[n]$ denotes a sequence of 128 samples, each randomly selected from $\{0,1\}$ '$*$' denotes cyclic convolution, ...

3

Use the second one Tony... It yields the correct implied phase relationship.

2

I did not see these mentioned in the prior good responses so I will add the following additional important reasons for zero padding: Radix-2 algorithms are more efficient so zero padding out to the next power of 2 (or power of 4 in some cases for radix-4), or more significantly avoiding any large prime factors can improve real time performance. Also when ...

2

Zero padding is a useful interpolation tool using sinc function (or kernel). I will below explain it in 3 parts. First: what is DFT; Second: Zero-padding; Third: Usage of zero-padding. (a) $\textbf{What is DFT}$: By taking a DFT of a data set we are mapping the data values from the current discrete domain (many case happens to be time example in audio ...

2

This is just about obtaining a symmetric signal after zero-padding. Take a symmetric signal (w.r.t. to time index $n=0$) and append zeros. Due to the implicit periodicity of the time signal used as input to the DFT, it does not matter if you append all zeros to the right, to the left, or on both ends of the symmetric signal. In any case, since the DFT/FFT ...

2

If you repeat your data, you will have discontinuities where the sequence ends meet. These will cause spurious peaks in your spectrum. You could apply a window to the data to taper it at the edges, but that would be a fair amount of work, and you'd need to work out a window that doesn't color your spectrum. I would just go with zero padding. It will mess ...

2

The disadvantage is you end up doing a longer FFT with higher computational cost: more MACs, energy spent toggling ALU/FPU transistors, memory paging and cache miss penalties, resulting in greater latency till the result is ready or requiring faster, hotter hardware. If you only need a few interpolated points (one, or a small fraction of log N), it may be ...

2

If you used a rectangular window (e.g. the same as no window) on your signal before the FFT, then you can interpolate any point between bin centers using a Sinc interpolation kernel (a short window-ed Sinc interpolation kernel may be a good enough approximation). Zero-padding and using a longer FFT is the same as this interpolation, and may be ...

2

You must zero-pad, whether implementing the delay in the time domain or the frequency domain. (Consider this: by delaying, you are making the signal longer.) Implementing the delay with the FFT implements a circular shift. If you don't pad and you use the FFT, the data will simply wrap around on itself. (Imagine that if you didn't zero pad and used the FFT ...

2

I suppose the array names are not descriptive of the contents and you have simply repurposed them. To zero-pad from 8x8 to 32x32: for (int i = 0; i < 32; i++) for (int j = 0; j < 32; j++) pspectrum[i][j] = 0; for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) pspectrum[i][j] = powerspectrum[i][j]; The purpose of ...

Only top voted, non community-wiki answers of a minimum length are eligible