Why filtfilt when filter transfer function easy to calculate in frequecy domain

조회 수: 1 (최근 30일)
My task requires zero-phase filtering. Why use the filtfilt command which increases the order of the filter by a factor of two when the same task could be done in the frequency domain without increasing filter order. All of my filtering is done off-line so the filter need not be causal. However, my results with filtfilt for similar filters are much smoother than my results with frequency domain filtering (ringing). I am guessing that I need to use a window on my time-series data to decrease the ringing.
  댓글 수: 2
Jan
Jan 2013년 2월 5일
What is your question? Could you post the used code such that we can see what exactly happens?
Paul
Paul 2013년 2월 5일
n = 1000;
nOrder = 4;
fc = 0.5; % normalized freq cutoff
y = randn(1,n);
y = [y zeros(1,200)]; %just to see some ringing
% matlab butterworth
[b,a] = butter(nOrder,fc);
y1 = filtfilt(b,a,y);
% frequency domain filtering
N = 2^nextpow2(length(y));
Y = fft(y,N);
%real signal is sym so we only need N/2 + 1
Y = Y(1:N/2+1);
% digital freq.
ff = linspace(0,1,N/2+1)/fc;
% butterworth filter
H = 1./sqrt((1+ff.^(2*nOrder)));
Y = Y.*H;
Y(2:end) = 2*Y(2:end);
y2 = real(ifft(Y,N));
y2 = y2(1:length(y));
figure;
plot(y);hold all;
plot(y1)
plot(y2)
legend('original','filtfilt','freq domain filter')

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by