ifft convert frequency domain to time domain
Show older comments
Hello everyone,
I have a function X in the frequency domain that I would like to convert to the time domain and get a plot in the time domain. However, the time domain singal has half of the oscillation period it should have. Would really appreciate any help! Here is the code i have:
m=1;
k=1;
c=0.01;
f=0:0.001:3;
omega=2.*f*pi;
X=1./(-omega.^2*m+1i*c.*omega+k);
% The Nyquist frequency is twice the maximum frequency in your signal
Fs = 2 * max(f) ;
N = length(f);
T = N / Fs; % Total time duration
t = 0:1/Fs:(N-1)/Fs;
% Compute the inverse Fourier transform
x = ifft(X, N);
% Plot the time-domain signal
figure
plot(t, x, 'b');
2 Comments
Star Strider
on 13 Feb 2024
If you have a one-sided complex Fourier transform (the magnitude and phase must be converted into the real and imaginary parts first), and the associated frequency vector, you will need to duplicate that as the complex conjugate, flip the complex conjugate, and concatenate it to the end of the original complex vector in order to do the inverse Fourier transform. Then, it should have the same length as the original signal.
The essential idea (assuming a row vector for simplicity) is:
reconstructed_fft = [original_complex_vector flip(conj(original_complex_vector))]
time_domain_signal = ifft(reconstructed_complex_vector)
In practice, it may be a bit more complicated than that.
The time vector then extends from 0 to length(time_domain_signal)-1 in steps of 1/(2*Fn) where ‘Fn’ is the Nyquist frequency. That should get you started.
Angie
on 13 Feb 2024
Accepted Answer
More Answers (1)
Basit
on 5 Oct 2024
0 votes
I think we can not get the time domain data as good signal by using iFFT
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





