How can I use the function fir1 and filtfilt together?
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Walter Roberson
le 20 Mar 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 commentaires
Voir également
Catégories
En savoir plus sur Digital Filtering dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!