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 Filter Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by