1
$\begingroup$

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)}}? $$

$\endgroup$
6
  • $\begingroup$ sorry, this question is underdefined/un-understandable. Zero padding adds zeros. It doesn't scale amplitude of the existing samples. $\endgroup$ Jul 15, 2016 at 10:51
  • $\begingroup$ I have edited my question to be more clear. $\endgroup$
    – Cali
    Jul 15, 2016 at 11:40
  • $\begingroup$ If you pad a length $N$ signal with $M$ zeros, how do you get $NM$ in the denominator of the exponential? $\endgroup$
    – Matt L.
    Jul 15, 2016 at 12:27
  • $\begingroup$ I am padding my signal with $M$ zeros in order to increase DFT size so correspondingly in denominator of the exponential I will have $MN$ because this is the new DFT size that I want (for whatever reason). $\endgroup$
    – Cali
    Jul 15, 2016 at 12:37
  • $\begingroup$ $N+M=MN$??? ${}$ $\endgroup$
    – Matt L.
    Jul 15, 2016 at 12:38

1 Answer 1

4
$\begingroup$

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

$\endgroup$
6
  • $\begingroup$ I think that in Eq. (2) and (4) your summation should go over $k$ and not $n$, right? Second comment is that summation in Eq. (2) and (4) should not go up to $N+M$ but just up to $N$ because by zero padding you will not increase number of frequencies, i.e., tones. $\endgroup$
    – Cali
    Jul 15, 2016 at 12:46
  • $\begingroup$ @Cali: yes, wrong index in (2) and (4), will edit. The index in (3) should only go to $N-1$ (as it does), but in (4) it must go to $N+M-1$. $\endgroup$
    – Matt L.
    Jul 15, 2016 at 12:49
  • $\begingroup$ Why should it go up to $N+M-1$? sorry but I do not understand, if you could edit you post with some additional explanation regarding that. $\endgroup$
    – Cali
    Jul 15, 2016 at 12:51
  • $\begingroup$ @Cali: The zero-padded time domain signal is zero for $n\ge N$, but why should the corresponding DFT equal zero for $k\ge N$? The DFT of the zero-padded signal is an interpolated version of the DFT of the original signal (without padding). Note that the result of $(4)$ is zero for $n\ge N$, but you have to add up all elements of the sum for all $k$ because there is generally no reason that $X[k]=0$ for $k\ge N$. $\endgroup$
    – Matt L.
    Jul 15, 2016 at 12:56
  • $\begingroup$ Let's say that each $k \in N$ represents one frequency of original signal which is in time domain represented as sum of $N$ sinusoidals. By zeropadding I am just adding zeros to the end of my signal not adding any new information, i.e., not capturing any new part of the signal and in the that way allowing for some additional frequencies to be catch. So I still do not get it why does frequency domain expands with zeropadding? To not get me wrong, I do not say that your answer is wrong but I'm just trying to find explanation which I understand. $\endgroup$
    – Cali
    Jul 15, 2016 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.