Jump to content

Quiet Filter


Enthalpy

Recommended Posts

Hello everybody!

Frequency filters lets signals within the passband through and attenuate everything in the stopband, for instance noise or an adjacent communication channel. Much theory exists for them, works nicely.

The stopband attenuation can be big, and the "selectivity", the ratio of the nearest frequencies of the stopband to the passband surprisingly small. But as the frequency response gets sharper, the time response gets slower and bumpier. No wonder, since a Fourier transform links them, like the diffraction rings of a lens, or the noise created by jpeg compression, or Delta(t) and Delta(E) for a particle.

I'll consider only lowpass filters here. They are the most common, and only their time response makes much sense for the eye.

Simple theorems only restrict the quickness (vague) of the filter for a given selectivity, not how much it rings. But as a typical filter rings at the extreme frequency of its passband, both seem related.

The time response of a filter matters in some uses, for instance if you observe shocks with an accelerometer. Then the frequency response can't be too sharp. But some kinds of filters, or "transfer functions" out(F)/in(F), offer a better compromise than others.

All the books and courses I know compare the step response of varied transfer functions at identical number of poles - identical complexity more or less. Then, the Butterworth is quietest, the Chebychev is in between, and the elliptic is bumpiest. The Bessel shows no overshot but filters too badly for most uses. (There are a dozen well-known named transfer functions).

But the aim of a filter is not to build a cetain number of poles! It must fit some passband with a maximum attenuation there and some stopband with a minimum attenuation. Then an elliptic filter needs fewer poles than a Chebychev that needs fewer than a Butterworth.

When comparing at identical constraint on the frequency response, hence with different numbers of poles, I claim that the step response of a Butterworth is bumpier than a Chebychev and an elliptic is quieter. Examples shall follow.

Marc Schaefer, aka Enthalpy

Link to comment
Share on other sites

I use the excellent FilterCad 3.0 software that Linear Technologies made nicely general
filtercad.software.informer.com
The application is said to run on recent Windows after helping the installer a bit.

The first case is a Butterworth. It has 16 poles because the competitors need less.

While -3dB is meaningful for audio applications, metrology and present datacomms demand more. Here 0.1dB attenuation or ripple in the passband, which equals 2% power or 1% voltage, is more realistic. This is not the usual "corner frequency" of a Butterworth given at -3dB. The big Butterworth gives unimpressive 40dB attenuation at 1.5* the passband edge, which shall be the definition of the stopband and its attenuation for the other transfer functions.

For its built-in transfer functions, FilterCad determines automatically the poles and zeros and draws the frequency and step responses.

Butt16d.png.2e76adb1d28de94936d53f46659d704c.png
Butt16f.png.5a6324463482700195182b83de7891e9.png
Butt16t.png.bf7e8fced48aba1ab2005793678e8b1b.png

Marc Schaefer, aka Enthalpy

Edited by Enthalpy
Link to comment
Share on other sites

And this is an elliptic (or Cauer) filter that fulfils the same requirements. With five poles and two notches, it isn't simpler to build than the Chebyshev, but it reacts sooner and steeper than both the Butterworth and Chebyshev, and it rings for shorter.

Ellipt5d.png.7b15db810a23d42d41998d1cca1785b7.png
Ellipt5f.png.04064de06aca260a816e9729668b83e2.png
Ellipt5t.png.8c85aa908a1986cd90dbd1f8bd2f86d8.png

Maybe I put an inverse (or type II) Chebyshev here some time. It rings clearly less and for shorter than the elliptic, very similar to an hourglass filter. But as none is native to FilterCad, it takes me longer.

Marc Schaefer, aka Enthalpy

Link to comment
Share on other sites

To improve the step response, a phase corrector is the answer. It appends a few second-order and possibly first-order "all-pass" cells, active or passive, which let the phase rotate around some frequency but leave the amplitude uniformly untouched.

But how to tune these all-pass cells ?

The universal answer, in all books and courses, is "make the propagation group constant in the passband", or equivalently, "make the phase linear". This is inspired by the pure time lag, whose propagation time is constant and phase linear. At digital FIR filters it works.

Either I've understood zilch, or all these authors just repeat something that sounds good but they have never done, because each and every time I tried that way, it failed miserably. As a hint, I have never-ever seen an example of step response by those who recommend a constant propagation group from the phase corrector. Not a single time.

So here's a example of failure. I first repeat the frequency response of the 5th order elliptic lowpass, this time with the group delay displayed, where you see the typical big bump around the corner frequency. Then I append three second-order allpass cells and optimize for uniform group delay in the passband. And then the step response is megayuk, much worse than the bare filter. More cells above the corner frequency don't improve.

GroupRawF.png.360105ac67a73cde9513d25112518bf5.png
GroupEquD.png.61ed102f62095d633e1de139a31f75fd.png
GroupEquF.png.1e00593108c2162aacc9bcef5615e0f3.png
GroupEquT.png.aef2e0a3533e50b150102d5e8789f0e1.png

I plan to show a successful phase corrector on that elliptic filter.

Marc Schaefer, aka Enthalpy

Link to comment
Share on other sites

4 hours ago, Enthalpy said:

[...] Either I've understood zilch [...]

And I was wrong. Equalizing the group delay time works, at least in a first approximation. My mistale was that I had never observed frequencies low enough. Equalizing only 2-3 octaves below the cutoff doesn't suffice and made the time response unbalanced.

This is again the 5th order elliptic low-pass, with a 5-pole phase corrector, tuned if not perfectly, and its impulse and step responses:

GroupEqu2c.png.235fd6c4367923f578d30e466227e812.png
GroupEqu2f.png.a945686f06ca1b75fffbb51370c210cd.png
GroupEqu2d.png.5ab2b164ff7267c6ba4b2002b004d02a.png
GroupEqu2s.png.50763fe0d6365c91639bf685d3320e07.png

  • Tuned phase correction cuts in half the ringing amplitude but adds as much before the main transition, in one pulse per corrector pole.
  • This improves much the visual impression on a real filtered signal.
  • A quieter filter keeps its advantage after phase correction.
  • The phase corrector adds group delay below the peak around the cutoff frequency. Above is useless.
  • If keeping the peak in the group delay at cutoff, the filter still delays the signal by as much, but the time response isn't quite pleasant.
  • A nicer time response results from more corrector poles, which increase the group delay up to the cutoff included, and increases the signal delay.
  • On a recorded signal, the delay can be compensated, but then the filtered signal begins to wobble before the raw one.
  • As can be seen above,  best symmetric ringing needs a somewhat uneven group delay, more so with fewer corrector poles, and needs hand tuning, which isn't finished here.
  • A continuous time filter or IIR can't be really symmetric, since its response is finite on the left.

Marc Schaefer, aka Enthalpy

Link to comment
Share on other sites

Here's a type II (or inverse) Chebyshev that fulfils the same 0.1dB in the passband and 40dB in the stopband starting at a frequency 1.5* higher.

FilterCad 3.0 doesn't design type II Chebyshev automatically (and its Min Q Elliptic falls short of the wanted frequency response). NuHertz does but isn't free any more beyond 3 poles. The design takes longer.

ChebyII8compute.png.2726d0f86cf4c083c1c92a3c725ef776.png

The pocket calculator HP48G solves the complex ch() and ach() easily, as it does with cos() and acos() for type I Chebychev, but mine just died. Mathcad 2000 is rumoured to factor real polynoms as first and second order terms, to be reinterpreted here as (w2+ww0/Q+w02) but I didn't find how. But Mathcad did give the complex roots of T8(alpha)=+-j99.995. Injecting the notches and poles in FilterCad gives the adequate frequency response.

ChebyII8c.png.b07cb3035466da448124465b9d79271f.png
ChebyII8f.png.5502c7d9faf89cec2c76cf52aecdd3ca.png
ChebyII8t.png.ccbed0cce1d530e25ebe83a2d64832bd.png

The step response is disappointing. Last time I compared, the type II Chebyshev was clearly quieter than the elliptic. Possibly I had a stronger attenuation and more room between the pass- and stopbands. Here some poles of the type II Chebyshev are in the stopband, so obviously it works outside its comfort zone.

Marc Schaefer, aka Enthalpy

Link to comment
Share on other sites

I checked on eBay the price of the HP-48G, and ¡caramba! All newer calculators must be bad since users still want this oldie. So I checked the price of my even older defunct HP-15C and it's even worse, ouch. One company
swissmicros.com
grasped that and makes an Helvète-Packard copy called DM-15L which sells new and improved for cheaper than old used HP-15C, but it costs something.

Free HP-15C emulators run on a PC. Good alternative, especially if you're used to the physical one.

HP did offer the emulators for free, a cache is there
calculatrices-hp.com over web.archive.org

  • The HP-50G computes complex trigonometric and hyperbolic functions. All hide in submenus even deeper than the HP-48G, so I can't recommend it.
  • The HP-15C does the job. But it has no usable keyboard shortcuts, and you have to click first on the f and g prefixes, so I wouldn't recommend it.
  • But the installer brings the handbooks!

Do not take this other HP-15C emulator, it ignores complex numbers:
hp15c.com

Torsten Manz made the best I've seen, downloaded from there
heise.de
Its blue and yellow tags around the keys are clickable, it reacts to the PC keyboard, and it's multilanguage. Tried briefly, it does complex acos and acosh as needed for Chebyshev type I and II filters. Nice!

Ah, to exit the complex mode, just click g > CF > 8 to clear the flag 8. You guessed.

Edited by Enthalpy
Link to comment
Share on other sites

  • 3 weeks later...

Sometimes the syntax for writing in the Wolfram language is as easy to follow as reverse polish notation (read that however you like). Sometimes its 

With[{tf = ButterworthFilterModel[3, s]},
Manipulate[
First@BodePlot[{tf, TransferFunctionTransform[type, tf]}, {0.01,
100}, GridLines -> Automatic,
PlotRange -> {{Full, {-60, 5}}, Automatic},
PlotLayout -> "List"], {{type, # &}, {# & -> "Lowpass",
1/# & -> "Highpass",
1/10 (#^2 + 1)/# & -> "Bandpass", (10 #)/(#^2 + 1) & ->
"Bandstop"}}]]

https://reference.wolfram.com/language/tutorial/AnalogFilterDesign.html#524371848

 

But I like using it all the same

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.