Frequency domain to Time domain Using IFFT : Symmetric figure problem
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi...
I want to convert the frequency domain data to time domain data...
But.. there is some problems...
clc
clear
close all
% Signal Generating
Fs = 3000;
Ts = 1/Fs;
t = 0 : Ts : 1-Ts;
f1 = 30;f2 = 70; f3 = 100;
w1 = 2* pi * f1; w2 = 2* pi * f2; w3 = 2* pi * f3;
theta1 = 0; theta2 = 0; theta3 = 0;
y = 1*exp(-1*t).*sin(w1.*t + theta1)+ ...
2*exp(-2*t).*sin(w2.*t + theta2)+ ...
3*exp(-3*t).*sin(w3.*t + theta3);
plot(t,y)
%% FFT & IFFT
[Frequency, Amplitude] = FFT_hg(t, y);
figure;
plot(Frequency, abs(Amplitude));
xlim([0 150])
B = ifft(Amplitude/2)*length(y);
t1 = (0:(1-Ts)/(length(B)-1):1-Ts);
figure;
B = real(B);
plot(t1,B)
grid on
From the above code...
Shape of figure(3) looks like symmetric...
I don't know, why the figure(1) and figure(3) are different...
Can you help me?
function [Frequency, Amplitude] = FFT_hg(Time, T_Amplitude)
fl=(length(Time)-1)/(max(Time)-min(Time));
L=length(T_Amplitude); %
LN=ceil(L/2);
A = fft(T_Amplitude);
X2=abs(2*A/L); %
Amplitude = X2(1:LN); %
f=fl*(0:L)/L;
Frequency=f(1:LN);
end
0 commentaires
Réponses (1)
Pat Gipper
le 12 Jan 2021
Your function produced a vector of complex numbers called "A". The original sequence will be reproduced using ifft(A). But the function went further by removing all the phase information by taking the absolute value of A.
0 commentaires
Voir également
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!