Converting frequency domain to Time Domain using IFFT.
Show older comments
Hello Experts,
I got a force data w.r.t frequency I want to convert it into force vs time. Can anyone please help with how to take sample rate, length and the plot with time of 0 to 10 secs
Thanks
5 Comments
Star Strider
on 1 Oct 2021
That depends on what the data are. If you have the amplitude and phase data, or the complex Fourier transform, and the lowest frequency is 0 Hz and the highest frequency is the Nyquist frequency, inverting it, even if you only have half of it, is straightforward. If you only have the amplitude or power, then inverting it is not possible.
Lokesh Katari
on 1 Oct 2021
Unfortunately, I cannot help. The data contain only frequency and magnitude, so it cannot be inverted.
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/755579/Force_Freq.xlsx', 'VariableNamingRule','preserve')
figure
plot(T1.Frequency, T1.('Force Signal'))
grid
.
Lokesh Katari
on 5 Oct 2021
Yashika Chauhan
on 4 Dec 2022
@Star Strider I also have same issue can you please help me with the code?
Answers (1)
I made some assumptions and managed to invert the frequency-domain signal —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/758601/Freq_to_timedomain.xlsx','VariableNamingRule','preserve')
% Check = [mean(diff(T1.Frequency)) std(diff(T1.Frequency))*1E15] % Check Frequency Spacing % Regularity
FT1 = T1.('Compressor Signal') .* exp(1j*deg2rad(T1.Phase)) % Complex Vector — Assumes Frequency In Hz & Phase In Degrees
FT1 = [0;FT1]; % Create % Concatenate DC Component
Fn = T1.Frequency(end); % Nyquist Frequency (Hz Assumed)
Fs = 2*Fn; % Sampling Frequency (Hz Assumed)
Ts = 1/Fs; % Sampling Interval (Sampling Period) (Seconds Assumed)
FT2 = [FT1; flip(conj(FT1))]; % Concatenate Flipped Complex Conjugate To End
Time = linspace(0, 1, numel(FT2))*Ts; % Create Time Vector (Assumes Highest Frequency Is The Nyquist Frequency)
IFT2 = ifft(FT2)
figure
yyaxis left
plot(T1.Frequency, T1.('Compressor Signal'))
ylabel('Amplitude')
yyaxis right
plot(T1.Frequency, T1.Phase)
ylabel('Phase (°)')
grid
title('Original One-Sided Fourier Transform')
figure
yyaxis left
plot(Time, real(IFT2))
ylabel('Real Component')
yyaxis right
plot(Time, imag(IFT2))
ylabel('Imaginary Componnent')
grid
title('Time-Domain Reconstruction')
xlim([min(Time) max(Time)])
There is something wrong with either the original data, or my interpretation of it (most likely the units, and that the omitted DC component is 0) and that the highest frequency in the data is the Nyquist frequency, because the imaginary component of the ifft should be essentially zero. (If the DC component is not 0, correct that in the ‘FT1’ creation assignment.)
I am confident that the code is correct, so it may be necessary to experiment with the unit conversions (if necessary) to produce a time-domain result with an essentially zero imaginary component. I have no idea what the original time-domain data look like, so I have nothing to compare it to.
.
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!

