How to do ifft to data derived in frequency domain
20 views (last 30 days)
I have some signal values derived in the frequency domain and I would like to derive also the corresponding values in time domain. Which is the best way to do it using the ifft matlab function?
Thanks in advance. Pete
Eric on 10 Nov 2014
Edited: Eric on 10 Nov 2014
I'm going to assume you have a vector f which is the frequency sampling vector and a signal s. Assuming s is in a centered coordinate system you can use the following:
assert(length(f)==length(s),'Lengths are not the same!');
delta_t = 1/(max(f)-min(f));
N = length(f);
t = (-fix(N/2):fix((N-1)/2)) * delta_t;%Works whether N is odd or even
g = fftshift(ifft(ifftshift(s)))*sqrt(numel(s));
The idea with the temporal sampling vector t is that the sampling width in the temporal domain is equal to the reciprocal of the length of the signal in the frequency domain. You then need to construct a vector t with that sampling such that the appropriate element is zero. When N is odd then the zero element is in the middle. When N is even the N/2 + 1 element is zero (i.e., there is one more negative value than positive).
The multiplication by sqrt(numel(s)) ensures that energy is conserved (see Parseval's Theorem). This normalization factor is dependent upon the particular definition Matlab uses for ifft. Other software platforms will require different normalization factors.
See my answer at http://www.mathworks.com/matlabcentral/answers/158434-about-frequency-in-fft for why I use the fftshift and ifftshift in this manner. The short answer is that, for the case where you're working in centered coordinate systems, it provides the correct phase.