Thanks to all the people who helped me here, I finally achieved to implement a notch filter (*), with coefficients given by : http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html
When I do order=2 (number of poles=4, according to this website), all is working very well with :
y[n] = a0*x[n-4] + a1*x[n-3] + a2*x[n-2] + a3*x[n-1] + a4*x[n] + b0*y[n-4] + b1*y[n-3] + b2*y[n-2] + b3*y[n-1]
When I try to increase order (example : order=4 or even order=3 => number of poles=6), then the filter doesn't work anymore. Very quickly (after
100), the signal is saturated to the max value : overflow !
(Nota : I work in
double (64 bits) floating point).
Somebody told that the higher the order, the more unstable ! What to do then to solve this problem ?
Thank you very much in advance.
(*) The IIR filter is even ... linear-phase ... thanks to the trick that someone gave me (apply the filter on the signal, then reverse the signal, then apply the filter again, then reverse the signal) !