1
$\begingroup$

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.

$\endgroup$
1
  • 1
    $\begingroup$ Why not use the DTFT? It can be implemented in five lines of code and allows you to sample at any frequencies you want. As long as M is not too large, execution speed won't be a problem on any modern computer. $\endgroup$
    – MBaz
    May 3, 2022 at 14:19

1 Answer 1

1
$\begingroup$

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:

Example of subsampling in the frequency domain.

$\endgroup$
3
  • $\begingroup$ In this case, how would you calculate the inverse DTFT as it involves a continuous integral of the frequency? $\endgroup$
    – ecook
    May 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$
    – ecook
    May 4, 2022 at 1:24

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.