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!