Low pass filtering in frequency domain

5 次查看(过去 30 天)
Hi,
I have a signal say 'InputSine' in time domain, I am taking it's fft and then low pass filtering it with a butterworth filter. Finally, I have to take ifft of the low pass filtered signal to get the signal back in time domain. I am getting correct result till low pass filtering step. After that I do not get the correct reconstructed signal in time domain. I think the problem is that I am trying to reconstruct time domain signal from one sided fft. Any suggestion to identify the problem will be highly appreciated.
M = csvread('InOut.csv',2);
time = M (:,1);
InputSine = M (:,2);
Fs = 1/(time(2)-time(1)); % Sampling Frequency
x = InputSine; % Input Signal
N = length(x);
X_Mag = abs(fft(x));
Bin_Vals = 0 : N-1;
Freq_Hz =(Bin_Vals*Fs/N);
N_2 = ceil(N/2);
semilogx(Freq_Hz(1:N_2), 20*log10(X_Mag(1:N_2)/(N/2)));
n = 1000; % order of filter
wc = 2*3.14*125; % cut off frequency
h = 1./(1+((2*3.14*Freq_Hz(1:N_2))./wc).^2*n); % filter transfer function
h = h';
Filtered_response = (X_Mag(1:N_2)/(N/2)).*h;
Inverse_Fourier = ifft(Filtered_response);
Amplitude = sqrt(Inverse_Fourier.*conj(Inverse_Fourier));
x_recon =(abs(Amplitude));
t = [0:1:length(x_recon)-1]/Fs;
plot(t,x_recon);

回答(1 个)

G A
G A 2019-5-3
fft(x) usually returns a complex value. X_Mag = abs(fft(x)); - from here you are losing the information about the real and imaginary parts of your signal in frequency domain. If you want to get correct transformation back to time domain again, you have to deal with the amplitudes of the signal, not with magnitudes.

类别

Help CenterFile Exchange 中查找有关 Filter Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by