I'm quite new to signal analysis, and I'm currently trying to understand under which conditions a Hilbert transform can be used to compute the correct instantaneous phase and enveloppe of a given signal.

Say I start from the example in Python given here (from the scipy website):

import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hilbert, chirp
duration = 1.0
fs = 400.0
samples = int(fs*duration)
t = np.arange(samples) / fs
signal = chirp(t, 20.0, t[-1], 100.0)
signal *= (1.0 + 0.5 * np.sin(2.0*np.pi*3.0*t) )

analytic_signal = hilbert(signal)
amplitude_envelope = np.abs(analytic_signal)
instantaneous_phase = np.unwrap(np.angle(analytic_signal))
instantaneous_frequency = (np.diff(instantaneous_phase) /
                            (2.0*np.pi) * fs)
fig = plt.figure()
ax0 = fig.add_subplot(211)
ax0.plot(t, signal, label='signal')
ax0.plot(t, amplitude_envelope, label='envelope')
ax0.set_xlabel("time in seconds")
ax1 = fig.add_subplot(212)
ax1.plot(t[1:], instantaneous_frequency)
ax1.set_xlabel("time in seconds")
ax1.set_ylim(0.0, 120.0)

I get a nice result showing me the enveloppe and desired frequency: enter image description here

However, if for instance I decide to add a little bit of noise:


Then the inferred enveloppe and frequencies get not that good (some of the noise goes into the enveloppe, some into the frequencies): enter image description here

This was quite expectable, and I know I just have to find a way to smooth my signal to solve that. My real problem is, say you add a trend to your signal:


Then the results get completely messed up: *can't add any more links since I'm new to the forum*

And the results are also messed up even for just a vertical shift... So, basically, my question is: what are the conditions needed for the Hilbert transform to return the correct phase and amplitude ?

For now, this is what I suppose:

  • the signal must not be noisy
  • the signal must be centered around zero
  • the signal must not have any trend
  • amplitude and frequency can vary

Am I right? Thank you.


1 Answer 1


A single instantaneous phase estimate may or may not make any sense if there is more than one frequency peak in the signal's local spectrum. So, to get a better single frequency and phase estimate, you may want to first high-pass filter your signal to remove the spectrum of any D.C. bias or slow trend, and also band-pass filter the signal to remove any outside spectral peaks due to noise or interfering signals.

So my off-hand guess for a condition is that the local spectrum has a single clear frequency peak with a monotonicly decreasing spectral magnitude away from that one peak. All the way to zero at DC for real signals.


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.