|
|
Inverse filter (decorrelation)Summary
IntroductionFrequently, the effect of one filter
For example, a radio frequency transceiver or a measurement instrument may include analog filters that introduce significant passband distortion. Exact inverseA possible approach is to calculate the compensation filter as the exact inverse of
In the discrete-time domain, The transfer function of To compensate the frequency response of It follows that In other words, the numerator of Minimum phase requirementA filter is minimum phase, if all its zeros fall inside the unit circle.Inverting it turns zeros into poles. Zeroes outside the unit circle become instable poles. Therefore, the exact inverse of a non-minimum phase filter is always instable. Nonzero amplitude responseAlso, there may not be any zeros on the unit circle.It is straightforward to see that once Note that such is the case for both ideal lowpass and highpass filters! In other words: The amplitude response may not be zero anywhere “on the frequency axis”. Approximate FIR inverseFilters in technical applications are rarely ideal, and it may be sufficient to find an FIR filter that approximates the inverse to a given accuracy.The matlab example program given below calculates the optimum compensation filter. It requires
Nominal delayFor a minimum phase system, the optimum delay is “none”:Figure 2 shows the equalizer impulse response for such a case. Nonetheless, the nominal delay was set to 6 samples. The least-squares solution gives zero for the first five taps before the main pulse, rendering them useless for equalization.
For a non-minimum phase system, the optimum delay should be “as long as possible”, shown in figure 3. Here, the nominal delay is 45 samples. In the same manner as before, samples after the main pulse are not useful for the compensation filter:
Finally, a system with zeros inside and outside the unit circle results in a compensation filter with an impulse response as shown in figure 4. Its envelope grows before the main tap, and decays afterwards. The optimum delay depends on the time constants of the envelope.
Figure 5 shows the impulse response of the channel. The result after equalization is shown in figure 6, and again in figure 7 on a logarithmic scale as
Code (Matlab / Octave)Download% *************************************************************
% Frequency response compensation
% © Markus Nentwig 2007
% provided without any warranty
%
% Calculation of a compensation filter to equalize the
% frequency response
% Note that this approach is not too useful for most
% engineering applications
% *************************************************************
close all; clear all;
% *************************************************************
% nomDelay: Latency
% --------
% if the channel is not minimum phase, the compensation filter
% becomes noncausal. This is taken into account by adding latency
% to the system.
% For a minimum phase channel, the compensation filter could be
% described by a finite number of coefficients.
% The impulse response is causal, but still infinitely long.
%
% Number of taps
% --------------
% The impulse response is infinitely long in every non-trivial
% case. An implementation as FIR filter needs to truncate it.
% Therefore, the resulting compensation filter is only an
% approximation anyway.
% *************************************************************
if 0
% Use conjugate pole pairs for no particular reason
% zeros inside the unit circle - minimum phase system
chan = poly([0.8*exp(0.3i*pi), 0.8*exp(-0.3i*pi)]);
nomDelay=0; % optimum - all taps left of the main pulse remain zero
elseif 0
% zeros outside the unit circle - nonminimum phase system
chan = poly([1.2*exp(0.3i*pi), 1.2*exp(-0.3i*pi)]);
nomDelay=1; % optimum - all taps right of the main pulse remain zero
elseif 1
% zeros both inside and outside the unit circle- nonminimum phase system
chan = poly([1.2*exp(0.3i*pi), 1.2*exp(-0.3i*pi), 0.8*exp(0.2i*pi), 0.8*exp(-0.2i*pi)]);
% compensation filter impulse response is both left and right of the main pulse
nomDelay=0.5; % arbitrary choice, not optimum
end
ntaps=50; % compensation filter length. Size -does- matter :)
% The convolution of channel and compensation filter should result in a pulse
% nomDelay gives the location of the pulse :
% 0: no delay (causal)
% 1: maximum delay (non-causal)
pulsePos=floor(nomDelay*(ntaps+length(chan)-1))+1;
% *************************************************************
% Calculate equalizer
% *************************************************************
base=[];
pchan=[chan zeros(1, ntaps)];
for k=1:ntaps
base=[base; circshift(pchan, [0, k-1])];
end
% the desired impulse response of channel -and- equalizer
ideal=zeros(1, length(chan)+ntaps);
ideal(pulsePos)=1;
% Backslash operator finds the least-squares solution for:
% sum of
% - 1st EQ tap times undelayed channel impulse response
% - plus 2nd EQ tap times 1-delayed ch. IR
% - plus 3rd EQ tap times 2-delayed ch. IR
% - plus ...
% equals ideal impulse response, allowing for some delay
eq=transpose(base)\transpose(ideal);
% *************************************************************
% Test it and plot
% *************************************************************
v=[1]; % test pulse
%v=[1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6i]; % alternative test pulse
% ... through channel (convolve with impulse response)
v=conv(v, chan);
% ... through equalizer (convolve with impulse response)
v=conv(v, eq);
figure(); stem(abs(v));
title('equalized pulse (linear scale)');
figure(); plot(20*log10(abs(v)+1e-20), '+');
title('equalized pulse (logarithmic scale)'); ylabel('dB');
figure(); stem(eq);
title('equalizer impulse response'); Further reading
© Markus Nentwig 2007-2008 The content of this page is provided without any warranty and may not be reproduced without permission. Comments? Questions?Please send me a mail! mnentwig@elisanet.fi |