0
$\begingroup$

I have some issue with zero padding. It's probably because I don't understand it enough.

I have buffer size set to 400. And I use radix-2 fft. So I take the input signal 400 samples, and add to them 112 zeros. So I have acceptable 512 buffer size for radix-2. And then I take the output of fft (freq spectrum) and send it to inverse radix fft. And that's what I get: enter image description here

it's my buffer window of size 512. So the end of buffer is cut. I suppose it's those 112 zeros. So it looks quite logical: actually I sent to my forward fft buffer size that has signal only for first 400 samples, and the rest are zeros. So after inverse I get what I had on input. I can understand that. But how to deal with that?

OK, I think I could just use from inverse fft output just those first 400 samples and it probably would work. But I wonder if it's proper way? Maybe there is some smarter solution, some filtering or what?

$\endgroup$
0
$\begingroup$

The result you experience is reasonable. The IDFT performs exactly the inverse operation of the forward DFT. Hence, for every signal $x[n], n=0...L$ you have the identity:

$$x[n] = \text{IDFT}\{\text{DFT}\{x[n]\}\}$$

This property is valid for DFT and hence also for FFT (as it is a special implementation of DFT).

So, if you insert a zero-padded sequence $x[n]$ into the FFT and immediately perform IFFT you obtain the zeropadded sequence as the output.

The question is: Why would you want to do that? If you think of performing filtering in the frequency domain, dont do it.

$\endgroup$
  • $\begingroup$ And of course I know the result is reasonable, I said that in my question, but instead word "reasonable" I used "logical" (due to my faulty English). But the question was how to avoid those "reasonable" results. I mentioned in question that I know I can use only first 400 samples from buffer and it would work. But is there any smarter methods to do that? $\endgroup$ – pajczur Jul 10 '18 at 4:58
  • $\begingroup$ And no I am not going to perform filtering by zeroing freq bins. I've already done that and I know the results :) Now I am just testing FFT, and try to understand that as best as I can. For example I wonder why Radix-2 is so popular. It allows you to perform FFT only for 2L buffer sizes. But there is great FFT called Mixed Radix. It allows you to perform FFT on almost each buffer sizes. So when there is so popular sample rating 44100, why not just use mixed radix? $\endgroup$ – pajczur Jul 10 '18 at 4:59
  • $\begingroup$ So your question is actually: Why is the radix2-fft so popular, whereas the mxed-radix are more rarely found? $\endgroup$ – Maximilian Matthé Jul 10 '18 at 5:36
  • $\begingroup$ It’s only one of many questions :) $\endgroup$ – pajczur Jul 10 '18 at 5:37
  • $\begingroup$ But here exactly I am asking how to avoid that issue which I have with radix-2 when I make zero padding $\endgroup$ – pajczur Jul 10 '18 at 5:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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