DSPRelated.com

Hilbert Transform

Category: Transforms | Also known as: Hilbert transformer

The Hilbert transform is a linear operator that phase-shifts every frequency component of a real signal by 90 degrees (pi/2 radians), producing the imaginary part of the signal's analytic representation. Together with the original signal as the real part, the two form a complex analytic signal whose instantaneous amplitude, phase, and frequency can be computed without ambiguity.

In practice

In embedded DSP, the Hilbert transform is most often implemented as a finite impulse response (FIR) filter — commonly called a Hilbert transformer — rather than computed via its continuous-domain integral definition. The ideal discrete-time Hilbert transformer impulse response is an odd-symmetric, non-causal sequence (h[n] = 2*sin²(pi*n/2) / (pi*n) for n != 0); note that this is the ideal sampled-domain counterpart to the continuous-time kernel 1/(pi*t), not the continuous-time expression itself. This sequence must be windowed and delayed to produce a practical causal FIR filter. The resulting filter introduces a constant group delay of (N-1)/2 samples, where N is the filter length, so the real (unfiltered) path must be delayed by the same amount to keep the two paths time-aligned before forming a complex pair.

A primary use case is single-sideband (SSB) modulation and demodulation, quadrature signal generation, and complex down-conversion. By pairing the Hilbert-transformed signal with the original, you get an analytic signal whose negative-frequency content is ideally fully removed; in practice, a finite FIR approximates this, attenuating rather than completely eliminating negative-frequency components. This is described in detail in the EmbeddedRelated posts "Add the Hilbert Transformer to Your DSP Toolkit, Part 1" and "Part 2", and applied concretely in "A Simple Complex Down-conversion Scheme" and "Phase or Frequency Shifter Using a Hilbert Transformer".

On resource-constrained MCUs and DSPs, filter length and multiplier count matter. The Hilbert transformer's odd-symmetry means roughly half the coefficients are zero for the ideal structure, which can approximately halve the number of multiplications needed relative to a general FIR of the same length, though the actual savings depend on the specific tap count and implementation. Half-band filter structures can reduce the arithmetic further; the EmbeddedRelated post "Multiplierless Half-band Filters and Hilbert Transformers" covers designs that eliminate multipliers almost entirely using coefficient quantization to powers of two, making them attractive for devices without a hardware multiplier or with a limited multiply-accumulate (MAC) budget.

A common pitfall is forgetting that the Hilbert transformer approximates a 90-degree phase shift only over a passband that is narrower than DC-to-Nyquist; response degrades near DC and near Nyquist/2. Filter length must be chosen to meet the required passband width and stopband rejection for the target signal bandwidth. Additionally, the group delay introduced by the FIR must be compensated in the real-signal path; failing to do so produces a misaligned analytic pair and corrupts instantaneous-frequency or envelope estimates.

 Learn this in DSP Foundations

Discussed on DSPRelated

Frequently asked

Why is the Hilbert transform implemented as an FIR filter in embedded systems rather than computed directly?
The continuous-domain Hilbert transform is defined as a convolution integral over all time, which is not directly computable on finite, causal data. In practice, the transform is approximated by a causal, windowed FIR filter whose frequency response is close to a 90-degree phase shift across a desired passband. This maps naturally to the MAC and DSP multiply-accumulate hardware present on most DSP cores and Cortex-M4/M7-class MCUs.
What is an analytic signal and why does it matter?
An analytic signal is a complex-valued signal z[n] = x[n] + j*xh[n], where x[n] is the original real signal and xh[n] is its Hilbert transform. Because all negative-frequency content is suppressed, the magnitude |z[n]| gives the instantaneous envelope and the derivative of angle(z[n]) gives instantaneous frequency. These quantities are useful in AM/FM demodulation, vibration analysis, and narrowband signal processing.
How do I compensate for the group delay introduced by the Hilbert transformer FIR?
A linear-phase FIR Hilbert transformer of length N introduces a delay of (N-1)/2 samples on the filtered (imaginary) path. The original (real) path must be delayed by the same number of samples, typically using a simple delay line or shift register, before the two paths are combined into a complex pair. Skipping this step results in a time-misaligned analytic signal.
Can the Hilbert transformer be used for frequency or phase shifting?
Yes. By combining the original signal and its Hilbert transform with sine and cosine weights (the Weaver or phasing method), you can shift the phase of a narrowband signal by an arbitrary angle or shift its frequency by a fixed offset without introducing an image. The EmbeddedRelated post 'Phase or Frequency Shifter Using a Hilbert Transformer' covers this technique in detail.
How do I reduce the computational cost of a Hilbert transformer on a resource-constrained device?
Several approaches help. First, because the ideal Hilbert transformer has odd symmetry, every other coefficient is exactly zero in the ideal structure, which can cut multiply operations roughly in half compared to a general FIR of the same length, depending on the specific tap count and implementation. Second, half-band filter structures can be exploited to reduce the coefficient count further. Third, if coefficients are quantized to sums of powers of two, multiplications reduce to shifts and adds, which is useful on cores without a hardware multiplier. The EmbeddedRelated post 'Multiplierless Half-band Filters and Hilbert Transformers' covers this approach.

Differentiators vs similar concepts

The Hilbert transform is sometimes confused with the Fourier transform. The Fourier transform decomposes a signal into its frequency-domain magnitude and phase spectrum; it produces a complex spectrum from a time-domain signal. The Hilbert transform instead produces a new time-domain signal (the 90-degree phase-shifted version) and is used to construct the analytic signal, not to analyze spectral content directly. It is also distinct from a simple 90-degree phase-shift network (such as an RC circuit), which achieves a 90-degree shift only at one frequency; the Hilbert transformer approximates a 90-degree shift across a broad passband.