Low pass filtering in frequency domain

17 visualizaciones (últimos 30 días)
Mohammad Zulqarnain
Mohammad Zulqarnain el 2 de Mayo de 2019
Comentada: Akhil el 29 de Nov. de 2022
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 comentario
Akhil
Akhil el 29 de Nov. de 2022
how to make a circular mask with radius

Iniciar sesión para comentar.

Respuestas (1)

G A
G A el 3 de Mayo de 2019
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.

Community Treasure Hunt

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

Start Hunting!

Translated by