Fred, a DSP engineer, goes to his favorite DSP store to do some shopping.

Fred: Hi, I'd like to buy a phase shifter.

Shop assistant: Hmm, what exactly do you mean?

Fred: Well, you know, if you put in a sinusoid like $x(t)=\sin(\omega_0t)$ you get $y(t)=\sin(\omega_0t-\theta)$ at the output, for any $\omega_0$. And of course, $\theta$ must be adjustable.

Shop assistant: Oh, I see. Sorry, no, we don't have those. But I remember other guys needing the same thing, and they always buy a Hilbert transformer, a couple of multipliers, and an adder, and they somehow connect all these things together to make an adjustable phase shifter.

Fred: Oh yes, right!

Fred pretends to understand what the guy is talking about. Of course he has no idea how to do that. He buys everything the guy said he needed, and thinks by himself that he might figure it out at home, or, everything else failing, he could ask it at DSP.SE.

How can Fred build a phase shifter with adjustable phase shift $\theta$ using the components he got at the store?

  • $\begingroup$ Great one! Please clarify if the phase must be the same for all frequencies (over a given band) or if a constant arbitrary delay would be sufficient (given any frequency, you can establish the phase, but the phase will be linearly changing with frequency). I think I know the answer for either case but will wait a couple days to see what else comes up! $\endgroup$ Jun 18 '16 at 15:57
  • $\begingroup$ This shop you are talking about... it's next to Hilbert's Hotel, right? $\endgroup$
    – M529
    Jun 18 '16 at 15:57
  • $\begingroup$ The only decent Hilbert transformers stocked by shops around here seem to have these huge input to output delays. I did see some faster ones in a catalog of time machines, but the Yelp reviews for that vendor seem to have 0 stars. $\endgroup$
    – hotpaw2
    Jun 18 '16 at 17:40
  • $\begingroup$ @DanBoschen: Any sinusoidal input will be shifted by $\theta$, regardless of its frequency. So the phase delay is different for every frequency. $\endgroup$
    – Matt L.
    Jun 18 '16 at 20:00
  • 2
    $\begingroup$ @hotpaw2: Just ignore those stars and get one quickly before they're sold out! $\endgroup$
    – Matt L.
    Jun 18 '16 at 20:02

Nice question! It uses one of my favorite trig identities (which can also be used to show that quadrature modulation is actually simultaneous amplitude and phase modulation).

The Hilbert transform of $\sin(2\pi f_0t)$ is $-\cos(2\pi f_0t)$. Also, $$\sin(2\pi f_0t+\theta)=a\sin(2\pi f_0t)+b\cos(2\pi f_0t)$$ (constrained to $a^2+b^2=1$), with $\theta=\text{atan2}(b,a)$. This suggest one possible approach. Say Fred needs $\theta=2.1$ radians. He calculates $\tan(2.1)\approx-1.71$. Then, he needs to find $a$ and $b$ such that $a^2+b^2=1$ and $b/a=-1.71$, with $a<0$ and $b>0$, which is a simple algebra problem. Set $a_0=-1$, $b_0=1.71$, $n=\sqrt{a_0^2+b_0^2}$, $a=a_0/n$, and $b=b_0/n$. Then, Fred can easily generate a sine with the desired phase by using a Hilbert transformer, two multipliers, two DC sources (one set to $a$ volts and the other to $-b$ volts, to take care of the sign of the cosine), and one adder.

The impulse response of the system described above is given by:

$a\delta(t)+\frac{b}{\pi t}$

Block diagram:

enter image description here

  • $\begingroup$ I like this, even though (or maybe because) it's a quite different derivation from the one I had in mind. Also note that it's maybe a bit easier to derive the constants $a$ and $b$ as $\cos\theta$ and $\sin\theta$, respectively. I'll wait a bit to see if there are any other answers coming in. $\endgroup$
    – Matt L.
    Jun 18 '16 at 20:23
  • $\begingroup$ For clarification, could you add the impulse response and/or frequency response of the total system? $\endgroup$
    – Matt L.
    Jun 18 '16 at 20:26
  • 1
    $\begingroup$ Very good MBaz, this is along the lines of what I was thinking- essentially a "vector modulator" which is a purchased component for this purpose (as one application). The HIlbert Transformer however cannot be purchased as a real component without restricting it to be band-limited (or I guess the user can get a different transformer for each band of interest). I am now very interested in seeing Matt's solution if it is different as this was all I could come up with. $\endgroup$ Jun 18 '16 at 21:47
  • 1
    $\begingroup$ @MattL. I've added the impulse response. I'll draw a diagram and post it too. Good point about the calculation of $a$ and $b$. $\endgroup$
    – MBaz
    Jun 19 '16 at 1:50
  • $\begingroup$ @DanBoschen Yeah, I've assumed the Hilbert transformer is ideal, which I think is OK for this puzzle. I'm also interested in seeing Matt's alternative solution. $\endgroup$
    – MBaz
    Jun 19 '16 at 1:51

MBaz's answer is correct. I would just like to add another way of thinking about it, of course leading to the same result:

An ideal phase shifter with phase shift $\theta$ has a frequency response $$H(\omega)=\begin{cases}e^{-j\theta},&\omega>0\\e^{j\theta},&\omega<0\end{cases}$$ which can be rewritten as $$H(\omega)=e^{-j\theta\text{sign}(\omega)}=\cos(\theta)-j\,\text{sign}(\omega)\sin(\theta)$$ The trained eye will identify $G(\omega)=-j\,\text{sign}(\omega)$ as the frequency response of an ideal Hilbert transformer. The corresponding impulse response is $g(t)=\frac{1}{\pi t}$. Consequently, the impulse response of the ideal phase shifter is $$h(t)=\cos(\theta)\delta(t)+\sin(\theta)\frac{1}{\pi t}$$ which can be implemented as a weighted parallel connection of a Hilbert transformer and a piece of wire with weights $\sin(\theta)$ and $\cos(\theta)$, respectively.

Note that this system can be approximated quite well in a practical (discrete-time) implementation. Just take a well designed FIR linear-phase Hilbert transformer of length $2N+1$, and add a delay of $N$ samples to the other signal path.

  • $\begingroup$ Nice explanation -- the frequency-domain counterpart of my time-domain solution. $\endgroup$
    – MBaz
    Jun 19 '16 at 15:55
  • 1
    $\begingroup$ @MBaz: Thanks! And the scaling factors $\sin(\theta)$ and $\cos(\theta)$ pop out automatically. $\endgroup$
    – Matt L.
    Jun 19 '16 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.