How to do ifft to data derived in frequency domain

3 visualizzazioni (ultimi 30 giorni)
Hello everybody,
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
  1 Commento
Dishant Arora
Dishant Arora il 10 Nov 2014
Please elaborate what you want to do, what do you mean by best way? There's a one to one correspondence between fft and it's inverse, so just take inverse using ifft.

Accedi per commentare.

Risposta accettata

Eric
Eric il 10 Nov 2014
Modificato: Eric il 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.
Good luck,
Eric

Più risposte (1)

Takis
Takis il 12 Nov 2014
Actually I'm using a numerical model that returns the signal values for distinct frequency values in a specific band. There is no fft involved in the procedure and that makes me feel uncomfortable in inverting the signal to the time domain. I think that Eric's answer solves my problem.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by