Low pass filtering in frequency domain

조회 수: 5 (최근 30일)
Mohammad Zulqarnain
Mohammad Zulqarnain 2019년 5월 2일
댓글: Akhil 2022년 11월 29일
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
Akhil
Akhil 2022년 11월 29일
how to make a circular mask with radius

댓글을 달려면 로그인하십시오.

답변 (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