# Behavior at DC and Nyquist of an ideal phase shifter

In Matt L's answer he states that an ideal phase shifter with a phase shift $$\theta$$ has a frequency response

$$H(\omega)= \begin{cases} e^{-j\theta},&\omega>0 \\ e^{j\theta},&\omega<0 \end{cases}$$

But what about DC and Nyquist? If I want to shift the phase of a real-valued signal $$x[n]$$, I suppose to get another real-valued signal $$y[n]$$ rather than a complex-valued signal. So $$H(\omega)$$ should be real at DC and Nyquist (actually in discrete world, $$H[k]$$) as well as $$X(\omega)$$ and $$Y(\omega)$$.

If we just let the frequency responses at these two frequencies equal to $$1$$, I can simply come up with an anti example that $$\theta=\pi$$, in which case $$y[n] = -x[n]$$, $$Y(\omega) = -X(\omega)$$ and thus $$H(\omega) = -1$$ for all frequencies.

Can anyone point my mistake out, thanks.

• Note that if you actually try to build such a phase shifter you'll find that the better you try to make it work at DC, the longer it needs to be. Oct 14, 2022 at 14:32
• You made a math error. $H(\pi) = e^{j \pi} = -1 = e^{-j\pi} = H(-\pi)$. Oct 14, 2022 at 14:32
• @TimWescott Sorry my bad, fixed. And is it due to the fact that an ideal Hilbert transformer is infinite long? Oct 15, 2022 at 7:31
• Or the fact that the Hilbert transformer is infinitely long is because filter length must go up as the sharpness of the transitions do. Oct 15, 2022 at 16:07
• @TimWescott Thanks. So although Hilbert transformer is an all-pass filter, the sharp transition of the phase response requires an infinite length. Oct 17, 2022 at 2:17

The frequency response of the ideal phase shifter can be written as

$$H(\omega)=\cos(\theta)-j\,\textrm{sgn}(\omega)\sin(\theta)\tag{1}$$

where $$\textrm{sgn}(\omega)$$ is the signum function.

Since $$\textrm{sgn}(0)=0$$, we have

$$H(0)=\cos(\theta)\tag{2}$$

which is purely real.

Note that for a Hilbert transformer we have $$\theta=\pi/2$$, and, according to $$(2)$$, $$H(0)=0$$.

In discrete time, the same is true at Nyquist.