How to design an inverse for a Butterworth low-pass filter?

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

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!

• 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. – Fat32 Jul 7 '15 at 10:57
• A stable exact inverse doesn't exist, as pointed out by the OP, because of the zero at Nyquist. – Matt L. Jul 7 '15 at 11:25
• @Fat32 I am just looking for a filter to whiten my signal as much as possible. – bastibe Jul 7 '15 at 11:36
• @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..? – Fat32 Jul 7 '15 at 21:24
• 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. – robert bristow-johnson Jul 7 '15 at 22:54

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:

[b,a] = butter(2,.005);     % some 2nd order Butterworth LP filter
r = 0.98;                   % desired pole radius < 1
b2 = a;                     % EQ numerator
a2 = [1,2*r,r*r];           % EQ denominator
k = sum(a2)/sum(b2);
b2 = k*b2;                  % scaling
[H1,w] = freqz(b,a,512);    % Butterworth frequency response
H2 = freqz(b2,a2,512);      % EQ frequency response

% plot EQ'd response
plot(w/pi,20*log10(abs(H1.*H2)))
grid on, xlabel('normalized frequency'),
ylabel('dB'), title('equalized response')


• Could someone explain why a2 is [1,2*r,r*r]? – Joost Aug 13 at 8:44
• @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}$. – Matt L. Aug 13 at 9:21

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.

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