0
$\begingroup$

This is a basic filter question I think. I want to define a narrow bandpass filter's cutoff frequencies (f1 & f2) for a particular central frequency (fc) in iir filter I think in this case

fc=(f1+f2)/2

But simply taking the average will give infinite possibilities of cutoff frequencies. So how would I select the f1 & f2 in particular? Based on -3dB cut off frequencies? In that case, is there a definite formula to consider this -3dB drop in the gain?

$\endgroup$
1
  • $\begingroup$ You should try using the geometric average between f1 and f2. $f_c = \sqrt{f_1 f_2}$ $\endgroup$
    – Ben
    Feb 26 at 13:32
1
$\begingroup$

The formulas for cutoff frequencies of a bandpass filter are different for different filter designs and can be calculated from the transfer function $H(ω)$. For a "basic" series RLC filter $$ H(ω) = {\frac {ωRC} {\sqrt{(1-ω^2LC)^2 + (ωRC)^2}} } $$ and this filter can be made narrowband if implemented with a high quality factor (see later in this text), but there are better designs for narrowband bandpass filters.

The 3dB level in amplitude is a ratio $1\over{\sqrt{2}}$; for an RLC filter the cutoff frequencies are calculated by solving the equation $$ {\frac {ωRC} {\sqrt{(1-ω^2LC)^2 + (ωRC)^2}} } = {1\over{\sqrt{2}}} $$ which is reduced to a quadratic equation having two roots $$ ω_1 = -{R\over{2L}}+{\sqrt{\left({R\over{2L}}\right)^2+{ω_c^2}}} \\ ω_2 = {R\over{2L}}+{\sqrt{\left({R\over{2L}}\right)^2+{ω_c^2}}} $$ $ω_c = {\frac {1} {\sqrt{LC}}}$ is a central frequency, $ω_1$ is a lower cutoff frequency, and $ω_2$ is a high cutoff frequency of the RLC filter. Unlike your guessed arithmetic mean, the central frequency of a RLC filter is a geometric mean $$ ω_c = {\sqrt{ω_1 ω_2}} $$

Another useful formula defines the filter bandwidth $$ BW_{LRC} = ω_2 - ω_1 = {\frac {ω_c} {Q}} $$ where $Q$ is a quality factor of the series RLC resonant tank: $$ Q = {\frac {ω_cL} {R}} = \frac {1} {ω_cRC} $$

For the other filter designs, the formulas are different.

Notice the use of an angular frequency ω in the formulas, $ω = 2\pi f$, which is customary for a signal processing math. Angular frequency is measured in radians per second.

UPDATE on question edit

The practical approach to constructing the filter is in the opposite direction to what you are seeking: given the design requirements, as the critical frequencies, ripple levels, and the sharpness of the cutoff, the priority of these requirements and the bill of materials, the developer selects the filter type, as Bessel, Butterworth, Chebyshev, elliptic or else, and adjusts the parameters to satisfy the requirements. See the filter example in your question's reference

sos = signal.iirfilter(17, [50, 200], rs=60, btype='band',
                       analog=False, ftype='cheby2', fs=2000,
                       output='sos')

the second parameter, [50, 200], sets the lower (50) and high (200) cutoff frequencies. Notice also in passing that in the Wikipedia article on the Chebyshev filter you can read

The common practice of defining the cutoff frequency at −3 dB is usually not applied to Chebyshev filters; instead the cutoff is taken as the point at which the gain falls to the value of the ripple for the final time.

Usually you do not select these frequencies arbitrarily. Your decision depends on what is the purpose of your filter. For example, when you design a filter for audio signal, you can set the lower cutoff 16Hz, and the high cutoff 20KHz, because it is the hearing range of humans, and the transmission or amplification of frequencies outside this range would only enhance distortions and waste the electric power.

$\endgroup$
4
  • $\begingroup$ Thanks for the response. But I am using scipy.signal.iirfilter. in python. I would like to know how the formula change for iirfilter also. I should include this in question i think. $\endgroup$
    – VGB
    Feb 26 at 9:25
  • 1
    $\begingroup$ The "formula" would change also for another fir filter with a different transfer function. What defines peak, lower cutoff and high cutoff frequencies is not only the finiteness of impulse response, but in the first place the exact formula for the filter's transfer function $H(ω)$. This transfer function exhaustively defines all the filter properties in the frequency domain, including, but not being limited to, cutoff frequencies $\endgroup$
    – V.V.T
    Feb 26 at 10:39
  • 1
    $\begingroup$ The cutoff frequency formulas for a filter, be it fir or iir, depend on all the parameters (arguments) that you enter into a constructor of the scipy.signal toolkit filter instance. Not only the coefficients in the formula, the structure of formula itself depend on the parameters of filter constructor. $\endgroup$
    – V.V.T
    Feb 26 at 10:49
  • 1
    $\begingroup$ So the routine is to define the filter, to compute the corresponding transfer function, and then find the central frequency (where $H(ω)$ reaches its maximum) and the frequencies for which the transfer function values are $1/\sqrt{2}$ of the maximum value. Complicated filters may have more than two such "cutoff" frequencies. $\endgroup$
    – V.V.T
    Feb 26 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.