Converting frequency domain to Time Domain using IFFT.

36 visualizaciones (últimos 30 días)
Lokesh Katari
Lokesh Katari el 1 de Oct. de 2021
Comentada: Yashika Chauhan el 4 de Dic. de 2022
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
Lokesh Katari
Lokesh Katari el 5 de Oct. de 2021
Now I got magnitude and phase data w.r.t frequency. Can you please help me with the code.
Yashika Chauhan
Yashika Chauhan el 4 de Dic. de 2022
@Star Strider I also have same issue can you please help me with the code?

Iniciar sesión para comentar.

Respuestas (1)

Star Strider
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')
T1 = 51×3 table
Frequency Compressor Signal Phase _________ _________________ ________ 39 0.44633 2.1385 78.22 0.22602 1.0094 117.44 0.0073646 -0.11463 156.66 0.010899 1.4285 195.88 0.0023688 1.1573 235.1 0.0063101 0.60217 274.32 0.0082103 0.948 313.54 0.010135 0.1509 352.76 0.0026814 1.9953 391.98 0.0021176 -2.2674 431.2 0.0012498 0.021459 470.42 0.00044738 -1.8534 509.64 0.00037295 -1.6413 548.86 0.00064796 1.326 588.08 0.00067373 2.2295 627.3 0.00083095 0.72299
% Check = [mean(diff(T1.Frequency)) std(diff(T1.Frequency))*1E15] % Check Frequency Spacing % Regularity
Check = 1×2
39.2200 59.1180
FT1 = T1.('Compressor Signal') .* exp(1j*deg2rad(T1.Phase)) % Complex Vector — Assumes Frequency In Hz & Phase In Degrees
FT1 =
0.4460 + 0.0167i 0.2260 + 0.0040i 0.0074 - 0.0000i 0.0109 + 0.0003i 0.0024 + 0.0000i 0.0063 + 0.0001i 0.0082 + 0.0001i 0.0101 + 0.0000i 0.0027 + 0.0001i 0.0021 - 0.0001i 0.0012 + 0.0000i 0.0004 - 0.0000i 0.0004 - 0.0000i 0.0006 + 0.0000i 0.0007 + 0.0000i 0.0008 + 0.0000i 0.0021 + 0.0001i 0.0006 - 0.0000i 0.0111 + 0.0003i 0.0054 - 0.0001i 0.0013 + 0.0001i 0.0010 - 0.0000i 0.0014 + 0.0000i 0.0016 - 0.0000i 0.0025 - 0.0000i 0.0006 + 0.0000i 0.0019 - 0.0000i 0.0016 + 0.0001i 0.0014 + 0.0000i 0.0022 - 0.0000i 0.0016 + 0.0000i 0.0008 - 0.0000i 0.0015 + 0.0001i 0.0054 + 0.0001i 0.0017 + 0.0001i 0.0032 + 0.0000i 0.0156 - 0.0002i 0.0092 + 0.0001i 0.0045 - 0.0001i 0.0039 - 0.0000i 0.0051 - 0.0001i 0.0032 + 0.0001i 0.0021 + 0.0001i 0.0037 + 0.0000i 0.0036 - 0.0000i 0.0044 + 0.0001i 0.0019 + 0.0001i 0.0030 + 0.0001i 0.0014 - 0.0000i 0.0014 + 0.0000i 0.0001 + 0.0000i
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)
IFT2 =
0.0161 - 0.0000i 0.0128 - 0.0004i 0.0128 - 0.0008i 0.0125 - 0.0011i 0.0108 - 0.0013i 0.0109 - 0.0017i 0.0093 - 0.0017i 0.0076 - 0.0016i 0.0069 - 0.0017i 0.0058 - 0.0016i 0.0046 - 0.0014i 0.0042 - 0.0015i 0.0021 - 0.0008i 0.0010 - 0.0004i -0.0000 + 0.0000i -0.0014 + 0.0007i -0.0021 + 0.0011i -0.0033 + 0.0019i -0.0046 + 0.0028i -0.0050 + 0.0033i -0.0055 + 0.0038i -0.0059 + 0.0043i -0.0061 + 0.0048i -0.0067 + 0.0056i -0.0067 + 0.0059i -0.0062 + 0.0059i -0.0065 + 0.0065i -0.0060 + 0.0064i -0.0059 + 0.0067i -0.0060 + 0.0072i -0.0052 + 0.0066i -0.0049 + 0.0066i -0.0045 + 0.0066i -0.0039 + 0.0060i -0.0037 + 0.0061i -0.0032 + 0.0057i -0.0025 + 0.0047i -0.0022 + 0.0044i -0.0018 + 0.0040i -0.0015 + 0.0036i -0.0013 + 0.0033i -0.0009 + 0.0026i -0.0006 + 0.0020i -0.0005 + 0.0018i -0.0004 + 0.0015i -0.0002 + 0.0010i -0.0002 + 0.0010i -0.0000 + 0.0002i -0.0000 + 0.0001i 0.0000 - 0.0000i 0.0000 - 0.0000i 0.0000 - 0.0000i 0.0000 - 0.0002i -0.0000 - 0.0005i -0.0000 - 0.0004i -0.0000 - 0.0004i -0.0001 - 0.0006i -0.0001 - 0.0007i -0.0003 - 0.0014i -0.0003 - 0.0015i -0.0005 - 0.0019i -0.0006 - 0.0022i -0.0007 - 0.0024i -0.0010 - 0.0030i -0.0014 - 0.0037i -0.0016 - 0.0039i -0.0019 - 0.0043i -0.0023 - 0.0047i -0.0026 - 0.0049i -0.0033 - 0.0058i -0.0037 - 0.0062i -0.0039 - 0.0060i -0.0045 - 0.0066i -0.0048 - 0.0066i -0.0051 - 0.0065i -0.0059 - 0.0070i -0.0058 - 0.0065i -0.0058 - 0.0061i -0.0062 - 0.0062i -0.0059 - 0.0056i -0.0063 - 0.0056i -0.0063 - 0.0053i -0.0056 - 0.0044i -0.0054 - 0.0040i -0.0050 - 0.0035i -0.0045 - 0.0029i -0.0040 - 0.0024i -0.0027 - 0.0015i -0.0014 - 0.0008i -0.0007 - 0.0003i 0.0007 + 0.0003i 0.0016 + 0.0007i 0.0028 + 0.0011i 0.0048 + 0.0017i 0.0053 + 0.0016i 0.0064 + 0.0018i 0.0075 + 0.0018i 0.0082 + 0.0018i 0.0098 + 0.0018i 0.0113 + 0.0017i 0.0111 + 0.0013i 0.0128 + 0.0012i 0.0130 + 0.0008i 0.0129 + 0.0004i
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.
.

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by