How can I use the function fir1 and filtfilt together?
9 次查看(过去 30 天)
显示 更早的评论
I need to use function fir1 for a bandpass filter and then I need to add a Zero-phase digital filtering with filtfilt.
I write:
d= fir1(20, [0.42 0.64]) %It's a 20-th order FIR bandpass filter and 0.42 and 0.64 my cut-off frequencies
y2= filtfilt(d,y); %y is my signal
It not works for filtfilt and the error is: Not enough input arguments.
Probably I need to use also the sample rate fz but I don't know where.
NB I don't want to use the function designfilt.
Thank you for help
0 个评论
回答(1 个)
Walter Roberson
2019-3-20
[b, a] = fir1(20, [0.42 0.64]);
y2 = filtfilt(B, A, y);
The two-output form of fir1 is not well documented. It turns out to always return 1 for a, so you could also use
d = fir1(20, [0.42 0.64]);
y2 = filtfilt(d, 1, y);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!