# Can we do down sampling by taking fft, omitting samples on the ends of the spectrum, and then taking inverse fft?

Suppose that we have a signal with a length of 4096 and want to down sample it by a factor of 2 and obtain a signal with a length of 2048.

Suppose that the the maximum frequency content of the signal is low enough that we do not have any concern about aliasing.

Obviously, the direct way is to keep every sample with an odd index and discard others.

Can we also take the FFT of signal, then omit samples from 1023-th index up to 3071-th index and then taking IFFT?

Note that samples from 1023-th index to 3071-th correspond to frequencies from -Fs/2 to -Fs/4 and Fs/4 to Fs/2.

I have tried this myself. I produced an example signal which is $$sin(2*\pi*t*10000) + cos(2*\pi*t*50000)$$. I down sampled it using both the direct time domain method and the described frequency domain method. The result is this:

The blue trace is resulted from the frequency domain method and the red line is resulted from the direct time domain method.

As you can see, in the first samples, the signals differ. But after that, they match. Why do they differ in the beginning? Do you think that I have done something wrong and that if everything was correct I should have achieved identical signals?

• I know what you meant, but 4096 / 2 = 2048. Commented May 25, 2023 at 3:22

Suppose that the the maximum frequency content of the signal is low enough that we do not have any concern about aliasing. ... Can we take the FFT of signal, then omit samples from 1023-th index up to 3071-th index and then taking IFFT?

Yes. If it's not just low but zero, then it's ideal downsampling and the original sequence is perfectly recoverable. Depending on how "low" it is, something simple like scipy.signal.decimate(, ftype='fir') will yield better results (filter by windowed sinc before subsampling). Related.

As you can see, in the first samples, the signals differ.

There must be exactly zero (within float precision) spectral contents for $$k \geq N/4$$ & $$k < -N/4$$ (in Python, np.allclose(fft(x)[N//4:-(N//4)], 0)), which for sines is achieved only by feeding "perfect sines" to DFT (integer number of cycles, cos(2*pi*f*range(N)/N)).

Subsampling in time <=> Folding in Fourier, which we can use to measure aliasing (answer's work-in-progress).

Can we do down sampling by taking fft, omitting samples on the ends of the spectrum, and then taking inverse fft?

In general, don't. There's no such thing as "omitting" that's different from "zeroing".