필터 지우기
필터 지우기

Manual implementation of filter function without using inbuilt filter function

조회 수: 12 (최근 30일)
Stefan
Stefan 2014년 1월 30일
답변: Wayne King 2014년 1월 30일
Hello,
I read that the FIR filter is basically a convolution of impulse response of system with input signal.
Or simply it is multiplication of time shifted impulse response and input signal.
I want to implement the filter using the multiplication instead using the inbuilt filter fucntion.
Can somone please explain how the mutlitiplication of the filter coefficients and an input signal can produce the result same as using the filtfilt filter function as shown below
d = fdesign.lowpass('Fp,Fst,Ap,Ast',5,12,1,20,100);
Hd1 = design(d);
data1 = filtfilt(Hd1.Numerator,1,data1);
thanks.

답변 (1개)

Wayne King
Wayne King 2014년 1월 30일
Hi Stefan, filtfilt() is not as simple as convolving the input signal with the filter impulse response.
filftilt() implements zero-phase filtering by convolving the data with the filter, reversing it and repeating the process.
In the Fourier domain this is equivalent to multiplying the Fourier transform of the data by the magnitude-squared Fourier transform of the filter.
So you can implement something close to filtfilt() like this:
Fs = 100;
t = 0:1/1/Fs:1-1/Fs;
x = cos(2*pi*2*t)+randn(size(t));
d = fdesign.lowpass('Fp,Fst,Ap,Ast',5,12,1,20,100);
Hd1 = design(d);
data1 = filtfilt(Hd1.Numerator,1,x);
%%now compare
filtdft = fft(Hd1.Numerator,100);
filtdft = abs(filtdft).^2;
xdft = fft(x);
ydft = xdft.*filtdft;
data2 = ifft(ydft,'symmetric');
plot(data1); hold on;
plot(data2,'r');
legend('filtfilt','Fourier domain filtering')

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by