I find myself in the position of having to lower the FFT resolution. Basically I have a signal of length M and I would like to make an FFT with N<M frequency bins. I cannot simply make several FFT's of length N and average them together because I need to preserve the phase of the frequency bin, since I need them for reconstructing a part of the signal. I just do not need a frequency resolution of M.
1 Answer
As @MBaz says in the comments, just do:
M = 1024;
N = 128;
x = randn(1,M);
X = fft(x);
XX = zeros(1,N);
for k=0:(N-1)
for t=0:(M-1)
XX(k+1) = x(t+1)*exp(-1j*2*pi*t*k/N) + XX(k+1);
end
end
plot([0:M-1]/M,abs(X));
hold on;
plot([0:N-1]/N,abs(XX),'r.')
And you get:
-
$\begingroup$ In this case, how would you calculate the inverse DTFT as it involves a continuous integral of the frequency? $\endgroup$– ecookMay 4, 2022 at 1:10
-
$\begingroup$ @ecook The inverse really won't have enough information to fully reconstitute the original signal. $\endgroup$– Peter K. ♦May 4, 2022 at 1:17
-
$\begingroup$ It's impossible to recover the time domain signal unless the frequency axis is densely sampled ($N>>M$ in the code)? If the frequency axis is oversampled, do we have to evaluate the IDTFT integral to find the original signal? Are there any fast methods? $\endgroup$– ecookMay 4, 2022 at 1:24
M
is not too large, execution speed won't be a problem on any modern computer. $\endgroup$