I have a signal with length 2000, and am taking an fft by 2048, after I perform analysis and some operation on signal in frequency domain I tried to convert it back to time domain. I received a signal length 2048, looking similar to what I would expect but not the same. I know that taking higher point fft simply generates more samples of the DTFT we would expect from the original signal, it does not add new information. However, when I take ifft my data length increases, I am assuming it must time domain interpolation between signal and output is same as if I would upsample my expected 1000 point signal (the operations I perform can be ignored, in my case if this is true for simply taking higher fft and then ifft of signal as is, then its true for me). I am not sure if this assumption is true, as I have yet to grasp how the IDFT works when length in frequency domain changes. I am performing analysis using MATLAB and am aware of the sampling rate and time. Can anyone please share some insight on if my assumption is true and any mathematical insight into it or point me to some freely available resource?
1 Answer
The longer FFT simply pads zeros to the original time domain signal. The inverse FFT should then be the original signal with zeros appended to the end.
The OP is correct that taking a longer FFT interpolates samples in frequency, and specifically provides more samples of the Discrete Time Fourier Transform. Why this occurs is clearer by observing the difference between the DFT and DTFT formulas as given below:
DFT:
$$F(k) = \sum_{n=0}^{N-1}x[n]e^{j k \omega_nn }$$
Where $\omega_n = 2\pi /N$
DTFT:
$$F(\omega) = \sum_{n=-\infty}^{\infty}x[n]e^{j \omega n }$$
For $\omega$ continuous from $0$ to $2\pi$ (for unique span)
Notice the two key differences: The time increment n in the DTFT extends to plus and minus infinity, and the frequency domain variable $\omega$ is a continuous function. As we add zeros to x[n] in the DFT, we approach the DTFT and ultimately for the same $x[n]$ all results of the DFT as more and more zeros are added will be samples on the continuous DTFT function.
In general related to this it is worthwhile to understand a universal property of all the Fourier Transforms related to signals that repeat or not (periodic or aperiodic) and continuous or sampled signals:
If a signal is continuous in one domain (time or frequency) it must be aperiodic in the other domain. And the counter-case is also true; if the non-zero values of a signal are discrete in one domain, it must be periodic in the other if we allow the domain to extend toward infinity. We see that immediately with the premise of the Fourier Series Expansion in that any single-valued analytic waveform over a finite interval can be represented by a discrete and infinite number of frequencies; adding together all those frequencies in the time domain over an infinite time duration will result in a periodic waveform.
With that observe the Continuous Time Fourier Transform (CTFT) as shown in the slide below. Regardless if the waveform itself is zero valued over a portion of the interval, the key point is the Transform itself uses a time axis that extends from minus infinity to plus infinity, and for that reason the frequency domain MUST be a continuous function: Frequency resolution is the inverse of observation time. If we have infinite time to observe a stationary signal, then we will have infinite frequency resolution. So the CTFT is of a signal in time that is continuous and aperiodic. Therefore the result in frequency is aperiodic and continuous.
Now compare this to the Fourier Series Expansion (FSE) as shown in the slide below, of a time slice of the same time domain signal. As previously explained, if the time is extended beyond the time interval from $0$ to $T$ the resulting waveform will be periodic. The FSE is specifically done over the interval from $0$ to $T$, but periodicity is implied as the exact same result in frequency would occur at the non-zero values if time was extended to minus and plus infinity. The frequency axis for the FSE is discrete since the results are defined for $n \omega_o$ with integer n. What also would occur if time was extended to infinity as explained for the CTFT is the frequency axis would become a continuous function, but the new interpolated values between the original samples would all be zero valued. The FSE of a signal in time from 0 to T is the same as a signal that is periodic in time over that same period. The signal in time is continuous and periodic, therefore the result in frequency is aperiodic and discrete (non-zero values are discrete).
Now compare this to the Discrete Time Fourier Transform (DTFT) as in the slide below for the same time domain waveform. The only difference from CTFT is that the signal is now sampled in time. Thus the signal that is now discrete and aperiodic in time will be periodic and continuous in frequency: The same frequency result in the CTFT becomes periodic in the DTFT.
Finally the Discrete Fourier Transform (DFT) combines both effects of the FSE and DTFT; time is discrete as in the DTFT and restricted to a finite interval as in the FSE, with implied periodicity in that we can equally extend time to plus or minus infinity without changing the non-zero results in frequency. Thus the DFT for the same time domain waveform as the cases above would appear as in the slide below. The signal that is discrete and periodic in time would be periodic and discrete in frequency.
-
$\begingroup$ Thank you , this helps immensely, was really looking for the part "The inverse FFT should then be the original signal with zeros appended to the end." I was only wanting to find out why does it mathematically equal appending zeros to original signal after bigger than length ifft. $\endgroup$ Commented Mar 13, 2021 at 12:35
-
$\begingroup$ @vikassajanani do you see how this answers that or is that part still not clear? See how in the last two slides comparing the DTFT to the DFT where the DTFT is the DFT with infinite zeros appended. So as you append zeros, you increase the number of samples in frequency until it ultimately becomes continuous. So if zero padding creates the interpolated spectrum, reversing that interpolated spectrum gives you back the original (zero-padded) signal. $\endgroup$ Commented Mar 13, 2021 at 12:41
-
$\begingroup$ yes, I see it now, it just became very clear, thanks for the amazing explanation. These slides are wonderful resources. $\endgroup$ Commented Mar 13, 2021 at 12:42
-
$\begingroup$ @vikassajanani Thank you! They are from a course I teach that is coming up online if you are interested (lots more like this): ieeeboston.org/event/digital-signal-processing-webinar that focuses on providing a unique intuitive understanding of DSP with but beyond the math. $\endgroup$ Commented Mar 13, 2021 at 12:44