I am trying to understand filter design. I am trying to implement butterworth filter which would have high,low and bandpass using the difference equation representation for FIR and IIR. Given the low and high cutoff frequency, how can I formulate the coefficients for FIR and IIR filter?
-
1$\begingroup$ Butterworth is an analog filter type; so, if we're talking about "coefficients", we're implicitly talking about some transformation of that into the digital domain (often, using the bilinear transform, by the way, all this is on the Butterworth Filter wikipedia page). So, are you sure you want to go there? Or are you actually looking for a digital filter fulfilling some kind of specification? $\endgroup$– Marcus MüllerApr 11, 2022 at 10:26
-
1$\begingroup$ No matter which way you go, dsprelated.com/freebooks/filters/… is a quite nice explanation. $\endgroup$– Marcus MüllerApr 11, 2022 at 10:27
-
$\begingroup$ (also, the Butterworth is an IIR filter, not sure what you mean with "for FIR"; a truncation?) $\endgroup$– Marcus MüllerApr 11, 2022 at 10:28
1 Answer
Marcus provided an excellent link in the comments under the questions for the underlying details.
If you just need the filter and not the underlying details in how to design it from scratch, (or to confirm your own understanding), you can get the coefficients from python using scipy.signal.butter
, or similarly from MATLAB/Octave using butter
. As Marcus indicated, the Butterworth filter has poles and zeros so must be an IIR to implement as a digital filter. If you want a linear phase FIR filter (which is referred to as "all zeros" as it's poles are all at the origin) use scipy.signal.firls
or scipy.signal.remez
. (firls
and firpm
in MATLAB/Octave).