4
$\begingroup$

I have a signal that has a spectral shape very similar to the transfer function of a second-order lowpass filter (butterworth design).

Filter-Spectrum

I would like to whiten the spectrum of this spectrum in the time domain. For that, I need a filter that reverses the effect of the second-order lowpass filter.

I can calculate the inverse filter of the second-order lowpass by exchanging the A- and B-coefficients, but this will amplify high frequency components to infinity.

How do I design a filter that has the inverse transfer function of a second-order butterworth design but does not amplify to infinity at $f_s/2$? The transfer function should have the same corner frequency, but smoothly rise with 12 dB per octave.

Is this even possible? Any pointers as to how to design such a filter would be helpful!

$\endgroup$
5
  • $\begingroup$ Are you looking for an mathematically exact inverse filter (system) or just a filter to whiten your signal as much as possible... In the former case you need to mathemathically specify the forward system so that its inverse can at least in principal be derived and implemented as a stable causal system provided the forward system satisfies certain properties. The latter just involves the design of a general bandpass filter with a specific magnitude response to amplify high frequencies while maintaning stability. $\endgroup$
    – Fat32
    Commented Jul 7, 2015 at 10:57
  • $\begingroup$ A stable exact inverse doesn't exist, as pointed out by the OP, because of the zero at Nyquist. $\endgroup$
    – Matt L.
    Commented Jul 7, 2015 at 11:25
  • 1
    $\begingroup$ @Fat32 I am just looking for a filter to whiten my signal as much as possible. $\endgroup$
    – bastibe
    Commented Jul 7, 2015 at 11:36
  • $\begingroup$ @Matt L. I am confused ? is the OP sure that the system to be inverted is a Butterworth filter or he "thinks" that it is so..? $\endgroup$
    – Fat32
    Commented Jul 7, 2015 at 21:24
  • 1
    $\begingroup$ bastibe, if all you need to do is invert a given Butterworth LPF, then all you need to do is swap the locations of the poles and zeros of the Butterworth LPF. the existing zeros will all be at $z=-1$, so when you put all of your poles there, you will have to bump them slightly inside the unit circle. you don't want a bunch of poles sitting squarely on (or outside of) the unit circle. $\endgroup$ Commented Jul 7, 2015 at 22:54

2 Answers 2

6
$\begingroup$

The simplest and probably best approach is to use a second order IIR filter exchanging numerator and denominator from the original filter - as you suggested - but move the double pole at $z=-1$ (Nyquist) slightly towards $z=0$, i.e. slightly decrease the pole radius to make the filter stable. Just play around with the exact value. The higher the value, the closer to Nyquist will the approximation of the inverse filter be.

This little Matlab/Octave program shows how to do it:

n = 2;                          % filter order      
[b,a] = butter(n,.1);           % some nth order Butterworth filter
r = 0.98;                       % desired EQ pole radius < 1
b2 = a;                         % EQ numerator
a2 = poly( - r * ones(n,1) );   % EQ denominator
k = sum(a2)/sum(b2);
b2 = k*b2;                      % scaling (for 0dB gain)
[H1,w] = freqz(b,a,1024);       % Butterworth frequency response
H2 = freqz(b2,a2,1024);         % EQ frequency response

enter image description here

$\endgroup$
5
  • $\begingroup$ Could someone explain why a2 is [1,2*r,r*r]? $\endgroup$
    – Joost
    Commented Aug 13, 2019 at 8:44
  • 1
    $\begingroup$ @Joost: You want a double pole at $z=-r$, $|r|<1$, so your denominator polynomial is $(1+rz^{-1})^2=1+2rz^{-1}+r^2z^{-2}$. $\endgroup$
    – Matt L.
    Commented Aug 13, 2019 at 9:21
  • $\begingroup$ Sorry to 'unearth' this thread, but I'm trying to do the same. I tried the code snippet from @Matt L. and it works, but only for second order butterworth filters. Not for third or higher order. Is there any other way to do this, specifically using Scipy ? Thanks for your help. $\endgroup$ Commented Feb 6, 2023 at 18:59
  • $\begingroup$ @FabriceAuzanneau Please do not post comments as answers. $\endgroup$
    – Peter K.
    Commented Feb 6, 2023 at 23:28
  • $\begingroup$ @FabriceAuzanneau: The method works for any filter order. The code snippet was written as an example for a second-order filter, but it should be straightforward to generalize it. $\endgroup$
    – Matt L.
    Commented Feb 7, 2023 at 8:05
1
$\begingroup$

If you are using Matlab or Octave, then consider trying firls. It allows you to specify an amplitude vs frequency template for the filter, which you can specify to avoid blow-up at high frequencies.

$\endgroup$
2
  • $\begingroup$ firls designs a filter with a piecewise linear magnitude response, so you can't use it here. $\endgroup$
    – Matt L.
    Commented Jul 7, 2015 at 11:04
  • $\begingroup$ Well, it'll be better than an unstable filter, @MattL. ;-) $\endgroup$
    – Peter K.
    Commented Jul 7, 2015 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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