How can I use the function fir1 and filtfilt together?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Walter Roberson
am 20 Mär. 2019
[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 Kommentare
Siehe auch
Kategorien
Mehr zu Digital Filtering finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!