I would like to design a complex and causal allpass filter with delay of $\pi/2$, but only for negative frequencies. The positive frequencies should have a delay of 0. Is that possible and how I should go about that?

  • $\begingroup$ not as an FIR, but you'll be happy to hear that the Hilbert transformer is a thing and there's multiple approximative ways of building one. $\endgroup$ Commented Jul 25, 2022 at 14:08
  • 1
    $\begingroup$ Hilbert transformer is a poster child of non-causality, so it depends how much latency the application can tolerate $\endgroup$
    – Hilmar
    Commented Jul 25, 2022 at 15:02

2 Answers 2


I recommend a windowed approach using the impulse response that provides this frequency response. This is easily done by frequency translating two windowed Sinc functions associated with a half-band filter prototype: One Sinc is frequency translated a quarter band to the left (by multiplying it with $e^{-j\pi n/2}$ in time, and then multiplied by $-j$ to provide the desired phase. The other Sinc is frequency translated a quarter band to the right with no phase modification. The sum of the two is the impulse response for the filter, i.e. the coefficients for an FIR filter implementation. To make it causal, this impulse response is shifted to the right in time by half the length of a filter, and therefore a matching delay is also used as the reference to the filter output. (There is no non-causal solution without having a matching delay, as any causal filter implementation will have a delay).

The results of this approach with a 101 tap FIR filter are plotted below:


Here is the detailed approach including Python code:

Create the "perfect" impulse response for a halfband brickwall filter (which is a Sinc function), and window using a Kaiser window:

ntaps = 101
n = np.arange(ntaps)- (ntaps-1)/2
halfband = 0.5 * np.sinc((ntaps-1)*n/2/ntaps) * sig.kaiser(ntaps,12)

This results in the base "zero-phase filter" with an impulse response and frequency given below:

zero phase filter

Frequency translate this filter to the negative frequency axis by multiplying with a quarter band rotating phasor in the time domain along with the desired $-j$ phase:

left = -1j*halfband * np.exp(-.966j*np.pi/2 * n)

(Note that a perfect quarter band rotation is $e^{-j\pi n/2}$ but I rotated slightly less so that the frequency response continues through DC, otherwise there would be a large dip in the magnitude response there due to the transition band of the filter).

This phase rotated result would be the impulse response that would provide the frequency response for the negative frequencies.

The impulse response for the positive frequencies is equally created by rotating in the other direction, with no modification to phase:

right = halfband * np.exp(0.966j*np.pi/2*n) 

The magnitude frequency response for the "left" and "right" impulse responses separately is plotted below, the "left" response has a phase of $-j$ while the "right" response has a phase of zero:

magnitude response for left and right

The composite impulse response is the sum of the two:

impulse = left+right

The above is the impulse response for a non-causal "zero-phase" filter. To be causal the entire impulse response is shifted (ntaps-1)/2 samples to the right, with the resulting impulse response as the coefficients for a complex FIR filter implementation plotted below:

Resulting Impulse Response

The filter will have a causal delay of (ntaps-1)/2 samples, so to create an output that is phase matched to the filter output with the desired phase modification for the negative frequencies, a phase matched path is provided by simply delaying the input signal (ntaps-1)/2 samples:


By comparing the filter output with reference to the "Phase Matched Output", we get the desired frequency response as first plotted at the start of this post.


This will be tricky. The impulse response of a filter like this something like

$$ h[n] = \left\{ \begin{array}{cl} \frac{1+j}{2} & : \ n = 0 \\ \frac{1+j}{n\pi} & : \ n = 2m+1, k \in \mathbb{Z} \\ 0 & : \ \text{otherwise} \\ \end{array} \right. $$

It's clearly non-causal, has infinite length and the impulse decays relatively slowly. Assuming the spectrum is $H[k]$, you have a phase discontinuity are $k=0$ and you have a contradiction at a $k=N/2$. Since the spectrum is periodic we have $H[-N/2] = H[N/2]$ so you can't have $H[-N/2] = e^{j\pi/2}$ and $H[+N/2]=1$ at the same time.

So your best shot here is to do an approximate design that's optimized for your specific requirements (maximum latency, frequency range of interest, required accuracy for phase and amplitude, complexity, etc.)


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.