Low pass filtering in frequency domain

3 ビュー (過去 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 Center および File ExchangeFilter Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by