Hi,
I tried the filter function, using coefficients for a 4th order butterworth filter and I am experiencing some troubles.
sometimes the algorithm seems to fail and gives a crazy output (for instance for coefficients B and A corresponding to a 4th order low_pass butterworth filter with F_cut ~ F_sample/10)
sometimes the algorithm seems to work, but the tranfer function of the filter (given by filter_spectrum) looks strange and very different than a filter designed with matlab. For instance for a bandpass butterworth, it is far from been flat in the band. This has a big impact on the data wich is strongly distorded.
I don't know if there is something wrong with the code, or if I am not using the filter function correctly. For example here are the coefficients for a 4th order bandpass butterworth with edge frequencies F_Samp/5 and 2F_samp/5 :
B =
0.0466 0 -0.1863 0 0.2795 0 -0.1863 0 0.0466
Forget my previous message, I was just missing the last coefficient (both for A and B) sent to the filter function. With the entire set of coefficients the function works perfectly ...
Sorry for the inconvenience !
Mickael
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I tried the filter function, using coefficients for a 4th order butterworth filter and I am experiencing some troubles.
sometimes the algorithm seems to fail and gives a crazy output (for instance for coefficients B and A corresponding to a 4th order low_pass butterworth filter with F_cut ~ F_sample/10)
sometimes the algorithm seems to work, but the tranfer function of the filter (given by filter_spectrum) looks strange and very different than a filter designed with matlab. For instance for a bandpass butterworth, it is far from been flat in the band. This has a big impact on the data wich is strongly distorded.
I don't know if there is something wrong with the code, or if I am not using the filter function correctly. For example here are the coefficients for a 4th order bandpass butterworth with edge frequencies F_Samp/5 and 2F_samp/5 :
B =
0.0466 0 -0.1863 0 0.2795 0 -0.1863 0 0.0466
A =
1.0000 1.8266 2.0990 1.8553 1.5560 0.8854 0.3882 0.1158 0.0301
then I used filter(B,A,data) where data is the signal I want to filter.
I woul appreciate any help.
Thanks !
Mickael
Forget my previous message, I was just missing the last coefficient (both for A and B) sent to the filter function. With the entire set of coefficients the function works perfectly ...
Sorry for the inconvenience !
Mickael