Scientific Computing · Signal Processing
The Analytic Signal and Instantaneous Frequency
How a Hilbert transform turns a real signal into a complex one with one-sided spectrum, why the derived phase derivative is not always a frequency, and where it fails.
A real sinusoid carries three parameters: amplitude, frequency, and phase. Only two of them can be read off the real samples directly, because the identity $\cos(\omega t + \phi) = \cos\omega t \cos\phi - \sin\omega t \sin\phi$ mixes amplitude and phase into a single coefficient pair and leaves the sign of the frequency undetermined. A real spectral analysis cannot tell whether a component sits at $+f$ or $-f$, because the real sinusoid’s spectrum has energy at both. The analytic signal is a construction that removes the negative-frequency half of the spectrum, and with it the ambiguity.
Suppressing the negative frequencies
For a real signal $x(t)$ with Fourier transform $X(f)$ satisfying $X(-f) = \overline{X(f)}$, the analytic signal is defined as $x_a(t) = x(t) + j \mathcal{H}{x}(t)$, where $\mathcal{H}$ denotes the Hilbert transform. In the frequency domain the operation multiplies by $1 + j(-j,\mathrm{sgn} f) = 1 + \mathrm{sgn} f$, which equals 2 for positive frequencies and 0 for negative ones.
So the analytic signal’s spectrum is $2X(f)$ for $f > 0$ and zero for $f < 0$. The real part is the original signal; the imaginary part, the Hilbert transform of the original, is a version in which every frequency component has been shifted by $-\pi/2$. The pair behaves as a complex exponential: for a pure tone at $\omega$, the analytic signal is $A e^{j(\omega t + \phi)}$, and both the amplitude and the phase are available as the magnitude and argument of a single complex number at each instant.
import numpy as np
fs = 1000.0
n = np.arange(4000)
t = n / fs
# Amplitude-modulated tone: envelope is a slow sinusoid
x = (1 + 0.6 * np.cos(2 * np.pi * 2.0 * t)) * np.cos(2 * np.pi * 50.0 * t)
def analytic(sig):
N = sig.size
X = np.fft.fft(sig)
# Doubling the positive half and zeroing the negative half is the filter.
H = np.zeros(N)
H[0] = 1
if N % 2 == 0:
H[1:N // 2] = 2
H[N // 2] = 1
else:
H[1:(N + 1) // 2] = 2
return np.fft.ifft(X * H)
z = analytic(x)
envelope = np.abs(z)
phase = np.unwrap(np.angle(z))
inst_freq = np.diff(phase) * fs / (2 * np.pi) # Hz
The reconstruction above is exact for a discrete record and is the usual way the transform is computed: a real-to-complex transform, a mask on the spectrum, and a complex inverse transform. The special treatment of the DC and Nyquist bins is not cosmetic. A purely real bin has no partner, so doubling it would double the DC offset and the Nyquist-rate component; halving those two, or leaving them at unit gain, preserves the real part while keeping the imaginary part sensible.
The imaginary part is not a measurement
The Hilbert transform is a non-causal operation with an impulse response $1/(\pi t)$, and the discrete version is an FIR approximation whose accuracy depends on the bandwidth over which the quadrature relationship holds. The imaginary part produced by the construction is a derived quantity, not an independently measured one. If the real signal has content outside the band over which the filter approximates a $\pi/2$ shift, the derived imaginary part is wrong in a way that produces spurious envelope modulation and phase jumps.
The discrete transform’s mask is exact in the sense that it produces a complex sequence whose real part is the input and whose spectrum has no negative frequencies, but it is not the same as the continuous Hilbert transform of the underlying continuous-time signal. The difference appears at the record boundaries: the transform treats the record as periodic, so the envelope’s behaviour near the ends reflects an assumed wrap-around, not the actual signal. Padding or windowing before the transform reduces the artifact but does not remove it.
There is also a bandwidth requirement. For the analytic signal to have a meaningful envelope, the message content of the real signal must occupy a band narrow compared with its centre frequency. A signal with content spread from near zero to a high frequency has a Hilbert transform whose envelope is nearly constant, because the negative-frequency content that the construction removed was not negligible and its removal changed the signal’s character rather than revealing a modulation. The construction yields one complex number per sample for any input, but the interpretation as a modulated carrier requires the narrowband assumption.
Instantaneous frequency is a derivative, with caveats
With the phase $\theta(t) = \arg z(t)$ unwrapped so that it is continuous, the instantaneous frequency is $\omega_i(t) = d\theta/dt$. For a pure tone this gives exactly the tone’s frequency, and for a slowly modulated carrier it gives a meaningful local frequency. The quantity is well defined mathematically wherever the analytic signal is nonzero.
The caveats are substantial. For a sum of two tones, the phase derivative is not the weighted average of their frequencies in any simple sense; it oscillates between values, and the analytic signal’s amplitude goes through zeros where the two components cancel. At an amplitude zero the phase is undefined and the derivative diverges. The instantaneous frequency of a two-tone signal therefore shows rapid swings, and interpreting those swings as physical frequency modulation is incorrect.
A second issue is that the derivative is defined per sample, so noise in the phase is amplified by the differencing. The variance of a single-sample phase estimate is inversely proportional to the signal-to-noise ratio, since a noise vector of fixed size perturbs the angle by an amount that shrinks as the signal vector grows. Differencing two successive phase estimates acts as a highpass on that noise, so the estimate is dominated by the fastest phase fluctuations in the record rather than by the average behaviour of the component. Smoothing the phase before differencing, or estimating the frequency from the phase of the lag-one autocorrelation, are both less sensitive to noise than a raw first difference. The autocorrelation estimator is the standard for frequency tracking in communication receivers for that reason: its estimate is bounded by the phase advance over one sample, which lies in $(-\pi, \pi]$.
# Frequency from the lag-one autocorrelation phase, immune to phase unwrap errors
z1 = z[1:]
z0 = z[:-1]
f_est = np.angle(np.mean(z1 * np.conj(z0))) * fs / (2 * np.pi)
print(f_est) # a single estimate of the mean frequency
Where the envelope is trustworthy and where it is not
The envelope $|z(t)|$ is the quantity most often used in practice, because amplitude modulation is common and the envelope’s interpretation is less sensitive to noise than the frequency’s. For a narrowband signal the envelope is the slowly varying amplitude, and its bandwidth is set by the modulation rate, not the carrier.
The envelope fails when the signal has more than one significant component within the passband. The sum of two comparable tones has an envelope that beats at the difference frequency, which is a genuine property of the sum but is often misread as amplitude modulation of a single carrier. The distinction matters in vibration analysis and in any application that infers a physical mechanism from an envelope shape: the beat envelope of two closely spaced resonances is not evidence of a modulated source.
Demodulation is the other main use. Multiplying a real bandpass signal by $e^{-j\omega_c t}$ shifts the carrier to DC, and the analytic signal of the result gives the baseband envelope and phase directly. Numerically this is usually done by forming the analytic signal at the intermediate frequency and multiplying by the complex exponential, rather than by a real multiplication followed by a filter, because the analytic construction already removes the image that a real multiplication would leave at twice the carrier frequency.
Relation to other time-frequency constructions
The analytic signal is a one-dimensional summary: one complex value per sample, with the assumption that at each instant there is a single amplitude and a single frequency. When the signal genuinely contains several simultaneous components, that assumption fails and the summary is misleading. The short-time Fourier transform avoids the assumption by keeping a distribution over frequency at each time, at the cost of a resolution limit set by the window length, which is the same uncertainty that governs the leakage behaviour described in Spectral Leakage, Scalloping, and Segment Averaging.
Empirical mode decomposition and related methods attempt to split a signal into components before applying the analytic signal to each, which is an admission that the single-component assumption is the binding constraint. The Hilbert-Huang approach applies the transform to intrinsic mode functions obtained from the signal’s own extrema, so the components are defined by the data rather than by a fixed band. The decomposition has no closed-form guarantee of uniqueness or orthogonality, which is the price of adapting to the signal.
The construction is also used as an intermediate in filter design. A Hilbert transformer is a filter with a $\pi/2$ phase shift across a band and zero response outside it, and its design follows the same windowing rules as any other FIR filter, with an antisymmetric impulse response of odd length. The passband ripple and phase accuracy of that filter determine how well the analytic signal approximates its ideal, so FIR Design by Windowing and the Gibbs Ripple sets the practical accuracy limit for the whole construction.
References
- Theory of Communication — D. Gabor, Journal of the IEE, vol. 93, 1946
- Discrete-Time Signal Processing — A. V. Oppenheim and R. W. Schafer, Pearson
- On the Concept of Instantaneous Frequency — L. Cohen, IEEE Transactions on Signal Processing, 1999