# Envelope of time domain signal // Hilbert transform

to get the envelope of a time domain signal, s(t), I use the absolute of its analytical time domain signal. But there occur the problem that sometimes the envelope is not as desired a true envelope but it follows more or less the original time domain signal.

Just for illustration some python code where the plot looks good:

from pylab import *
import numpy
import scipy.signal.signaltools as sigtool

x = linspace(0,5,1e4)

s= numpy.sin(2*numpy.pi*x)*numpy.exp(-x**2/2)
env = numpy.abs(sigtool.hilbert(s)) # hilbert(s) actually returns the analytical signal

plot(x,s,label='Time Signal')
plot(x,env,label='Envelope')
legend()
show()


By changing the data for example to (taking abs):

s = numpy.abs(numpy.sin(2*numpy.pi*x)*numpy.exp(-x**2/2))


the resulting envelope is following the "ripples" instead of being an envelope.

--- WHY? ---

Hilbert envelope, also called Energy-Time Curve (ETC), only works well for narrow-band fluctuations. Producing an analytic signal, of which you later take the absolute value, is a linear operation, so it treats all frequencies of your signal equally. If you give it a pure sine wave, it will indeed return to you a straight line. When you give it white noise however, you will likely get noise back.

Example 1:

$$\lvert\cos(\omega t)\rvert^2 + \lvert i\sin(\omega t)\rvert^2 = \cos^2(\omega t) + \sin^2(\omega t)= 1$$

Here, you have $\cos(\omega t)$ as you input signal, and its analysis counterpart is $\cos(\omega t) + i\sin(\omega t)$. In it easy to see from expression above that its envelope is always a constant. Let's look at another example.

Example 2:

Let $x(t) = \cos(\omega_1 t) + \cos(\omega_2 t)$. Then its analytic counterpart is $$a(t) = \cos(\omega_1 t) + \cos(\omega_2 t) + i\sin(\omega_1 t) + i\sin(\omega_2 t).$$ Let's take the absolute value of this signal.

\begin{align} \lvert a(t)\rvert^2 &= \lvert\cos(\omega_1 t) + \cos(\omega_2 t)\rvert^2 + \lvert i\sin(\omega_1 t) + i\sin(\omega_2 t)\rvert^2\\&=\left(\cos(\omega_1 t) + \cos(\omega_2 t)\right)^2 + \left( \sin(\omega_1 t) + \sin(\omega_2 t) \right)^2 \\ &= \cos^2(\omega_1t) + \cos(\omega_1t)\cos(\omega_2t) + \cos^2(\omega_2t)\\& \quad + \sin^2(\omega_1t) + \sin(\omega_1t)\sin(\omega_2t) + \sin^2(\omega_2t) \\&= \cos^2(\omega_1t) + \frac{1}{2}\left[ \cos(\omega_1t-\omega_2t)+\cos(\omega_1t+\omega_2t)\right] + \cos^2(\omega_2t)\\&\quad + \sin^2(\omega_1t) + \frac{1}{2}\left[ \sin(\omega_1t-\omega_2t)-\sin(\omega_1t+\omega_2t)\right] + \sin^2(\omega_2t) \\ &= \left[ \cos^2(\omega_1t) + \sin^2(\omega_1t)\right] + \left[ \cos^2(\omega_2t) + \sin^2(\omega_2t)\right] \\ &\quad + \frac{1}{2}\left[\cos(\omega_1t-\omega_2t) + \cos(\omega_1t-\omega_2t) \right] + \frac{1}{2}\left[\sin(\omega_1t+\omega_2t) - \sin(\omega_1t+\omega_2t) \right] \\ &= 1 + 1 + \cos(\omega_1t - \omega_2t) + 0 \\ &= 2+\cos\left( \left[\omega_1-\omega_2\right]t\right)\end{align}

As you can see, this is not a constant as one would expect. Note that if $\omega_1$ and $\omega_2$ are close to each other, only low-frequency oscillations are produced as an artifact. hope this helps.

• Hilbert transform of cos is sin and not -sin. See en.wikipedia.org/wiki/Analytic_signal#Examples Aug 19 '13 at 9:39
• @user13107 Yes, you're right. I fixed it. Aug 19 '13 at 17:06