Thursday, September 7, 2017

discrete signals - Zeropadding and amplitude scaling


Could somebody tell me what is the DFT scaling of a $N$-length signal which is padded with $M$ zeros ? Is it $1/(M+N)$ or $1/N$, i.e. $$ Y_k=\frac{1}{N}\sum_{n=0}^{N-1}y(n)e^{\frac{2\pi nk}{(M+N)}} \quad \text{or}\quad Y_k=\frac{1}{(M+N)}\sum_{n=0}^{N-1}y(n)e^{\frac{2\pi nk}{(M+N)}}? $$



Answer



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 increased to $N+M$, and the DFT becomes



$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/(N+M)}\tag{3}$$


The corresponding inverse DFT is


$$x[n]=\frac{1}{N+M}\sum_{k=0}^{N+M-1}X[k]e^{j2\pi nk/(N+M)}\tag{4}$$




EDIT:

In reaction to your comments, it is indeed necessary to sum over all indices $k$ up to $N+M-1$ in the sum of Eq. $(4)$. A simple example will illustrate this. Take a sinusoidal signal with an integer number of periods inside the DFT length:



N = 16;
n = 0:N-1;
x = sin(pi/4*n);

X = fft(x);

Its DFT X consists of two impulses. However, the DFT of the zero padded signal shows the underlying sinc-like behavior due to the rectangular window. Note that the DFT is just a sampled version of the DTFT, which has a continuous frequency variable. Zero padding just increases the sample density in the frequency domain:



xz = [x,zeros(1,N)];
Xz = fft(xz);
subplot(1,2,1),stem(abs(X))
subplot(1,2,2),stem(abs(Xz))

enter image description here



No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, $\ce{Mg^2+}$ is closest in radius to $\ce{Li+}$. Is this true, and if so, why would a whole larger shell ($\ce{...