Converting frequency domain to Time Domain using IFFT.
36 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Yashika Chauhan
el 4 de Dic. de 2022
@Star Strider I also have same issue can you please help me with the code?
Respuestas (1)
Star Strider
el 5 de Oct. de 2021
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.
.
0 comentarios
Ver también
Categorías
Más información sobre Spectral Measurements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!