I want to model a "negative dispersion" in waveguides.

Is it possible to design an all pass filter with inverted phase response? (e.g. -pi at 0 and pi at Nyquist)?

I feel :) this could be possible in complex domain (but don't know how). I could use a Hilbert transformer to complexity real signal at first.

  • $\begingroup$ This is used in "phase correction" to convert a minimum-phase filter into a linear-phase filter, right? $\endgroup$
    – endolith
    Nov 14, 2013 at 15:04
  • $\begingroup$ Just out of curiosity: what is the application? If the purpose is a model of a waveguide why does it have to real-time? And are we talking of optical or RF waveguides (though it's theoretically the same)? $\endgroup$
    – Deve
    Nov 15, 2013 at 9:25

2 Answers 2


Sort of. The inverse of an allpass filter is also an allpass filter and can simply be calculated by time flipping the impulse response. However that makes the filter non-causal. So you need to add bulk delay to make it causal again. As long as you don't need to do real time processing, that's typically not a problem.

EDIT: add a specific example. The key is to do the filtering in the time domain. You need to truncate the IIR response to an FIR response using "enough" samples.

% create an arbitrary allpass filter
b = [-.5 1]; a = [1 -.5];

% calculate the impulse response
n = 128; d0 = zeros(n,1); d0(1)= 1;
h1 = filter(b,a,d0);

% time flip and shift by 1 to keep the first sample in the same spot
h2 = circshift(flipud(h1),1);

% plot frequency responses
fh1 = fft(h1);
fh2 = fft(h2);
phases = unwrap([angle(fh1(1:n/2+1,:)) angle(fh2(1:n/2+1,:))]);
  • $\begingroup$ Can you give a more detailed example? Flipping the transfer function/impulse response is equivalent to swapping poles and zeros? But then poles are outside the unit circle. Delay can be thought of as an FIR filter with transfer function H(z) = z^(-N) (multiple zeros at the origin)? And you cascade these together and that makes it ok that the poles are outside the unit circle? $\endgroup$
    – endolith
    Nov 14, 2013 at 15:15
  • $\begingroup$ FIR is always stable. Thanks! Although I hope there is a solution suitable for real-time processing. How about truncated IIR? $\endgroup$ Nov 14, 2013 at 19:51

Assuming by "negative dispersion" you mean that lower frequencies travel faster, don't try to invert the phase, this will be like trying to have a time-traveling dispersion filter. Rather, design an allpass filter with phase delay that increases (rather than decreases) with frequency.

If you're doing a 1st-order allpass, for example,

D1(z) = (-0.9 + z^-1)/(1 - 0.9z^-1)

will have a phase delay that decreaes with frequency. And

D2(z) = (0.9 + z^-1)/(1 + 0.9z^-1)

will have a phase delay that increases with frequency.

The only real drawback is you can't as cheaply or easily get comparatively large phase delays at higher frequencies.

  • $\begingroup$ Doesn't negative D make the filter unstable? If it works I can always cascade several of them. $\endgroup$ Nov 16, 2013 at 7:58
  • $\begingroup$ The examples I've given have positive (phase) delay. And yes, you can cascade. $\endgroup$
    – HerrLip
    Nov 16, 2013 at 8:24

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.