9.4. DESIGNING A DISCRETE HILBERT
TRANSFORMER
Discrete Hilbert transformations can be
implemented in either the time or frequency domains. Let's look at
timedomain Hilbert transformers first.
9.4.1 TimeDomain Hilbert
Transformation: FIR Filter Implementation
Looking back at Figure 94, and
having h(n) available, we want to know how to
generate the discrete x_{i}(n). Recalling the frequencydomain
product in Eq. (91), we
can say x_{i}(n) is the convolution of x_{r}(n) and h(k).
Mathematically, this is:
So this means we can implement a Hilbert
transformer as a discrete nonrecursive finite impulse response
(FIR) filter structure as shown in Figure 910.
Figure 910. FIR implementation of a
Ktap Hilbert transformer.
Designing a traditional timedomain FIR Hilbert
transformer amounts to determining those h(k)
values so the functional block diagram in Figure 94 can
be implemented. Our first thought is merely to take the h(n)
coefficient values from Eq. (911), or
Figure 99, and
use them for the h(k)'s in Figure 910. That's almost the right answer.
Unfortunately, the Figure 99
h(n) sequence is infinite in length, so we
have to truncate the sequence. Figuring out what the truncated
h(n) should be is where the true design
activity takes place.
To start with, we have to decide if our
truncated h(n) sequence will have an odd or even
length. We make this decision by recalling that FIR implementations
having antisymmetric coefficients and an odd, or even, number of
taps are called a Type III, or a Type IV, system respectively[13].
These two antisymmetric filter types have the following
unavoidable restrictions with respect to their frequency magnitude
responses H(w):
h(n)
length:

Odd (Type III)

Even (Type IV)


H(0) = 0

H(0) = 0


H(w_{s}/2) = 0

H(w_{s}/2) no restriction

What this little table tells us is oddtap
Hilbert transformers always have a zero magnitude response at both
zero Hz and at half the sample rate. Eventap Hilbert transformers
always have a zero magnitude response at zero Hz. Let's look at
some examples.
Figure
911 shows the frequency response of a 15tap (Type III,
oddtap) FIR Hilbert transformer whose coefficients are designated
as h_{1}(k). These plots have much to teach
us.
Figure 911. H_{1}(w) frequency response of h_{1}(k), a 15tap Hilbert transformer.

For example, an oddtap FIR implementation does
indeed have a zero magnitude response at 0 Hz and ±f_{s}/2 Hz. This means oddtap
(Type III) FIR implementations turn out to be bandpass in
performance.

There's ripple in the H_{1}(w) passband. We should have expected this
because we were unable to use an infinite number of h_{1}(k) coefficients. Here, just as it does
when we're designing standard lowpass FIR filters, truncating the
length of the timedomain coefficients causes ripples in the
frequency domain. (When we abruptly truncate a function in one
domain, Mother Nature pays us back by invoking the Gibbs
phenomenon, resulting in ripples in the other domain.) You guessed
it. We can reduce the ripple in H_{1}(w) by windowing the truncated h_{1}(k) sequence. However, windowing the
coefficients will narrow the bandwidth of H_{1}(w) somewhat, so using more coefficients may be
necessary after windowing is applied. You'll find windowing the
truncated h_{1}(k) sequence to be to your advantage.

It's exceedingly difficult to compute the HT of
lowfrequency signals. We can widen (somewhat) and reduce the
transition region width of H_{1}(w)'s magnitude response, but that requires
many filter taps.

The phase response of H_{1}(w) is linear, as it should be when the
coefficients' absolute values are symmetrical. The slope of the
phase curve (that is constant in our case) is proportional to the
time delay a signal sequence experiences traversing the FIR filter.
More on this in a moment. That discontinuity in the phase response
at 0 Hz corresponds to p radians, as Figure 92
tells us it should. Whew, good thing. That's what we were after in
the first place!
In our relentless pursuit of correct results,
we're forced to compensate for the linear phase shift of H_{1}(w)—that constant time value equal to the
group delay of the filter—when we generate our analytic x_{c}(n). We do this by delaying, in time, the
original x_{r}(n) by an amount equal to the group delay
of the h_{1}(k) FIR Hilbert transformer. Recall that
the group delay G of a Ktap FIR filter, measured in samples,
is G = (K–1)/2 samples. So our block
diagram for generating a complex x_{c}(n) signal, using an FIR structure, is
given in Figure 912(a).
There we delay x_{r}(n) by G
= (7–1)/2 = 3 samples, generating the delayed sequence x'_{r}(n). This delayed sequence now aligns
properly in time with x_{i}(n).
Figure 912. Generating an x_{c}(n) sequence when h(k) is
a 7tap FIR Hilbert filter: (a) processing steps; (b) filter
structure.
If you're building your oddtap FIR Hilbert
transform in hardware, an easy way to obtain x'_{r}(n) is to tap
off the original x_{r}(n) sequence at the center tap of the FIR
Hilbert transformer structure as in Figure 912(b). If you're modeling Figure 912(a) in software,
the x'_{r}(n) sequence can be had by inserting
G = 3 zeros at the beginning of
the original x_{r}(n) sequence.
We can, for example, implement an FIR Hilbert
transformer using a Type IV FIR structure, with its even number of
taps. Figure 913 shows
this notion where the coefficients are, say, h_{2}(k). See how the frequency magnitude
response is nonzero at ±f_{s}/2 Hz. Thus this eventap
filter approximates an ideal Hilbert transformer somewhat better
than an oddtap implementation.
Figure 913. H_{2}(w) frequency response of h_{2}(k), a 14tap Hilbert transformer.
One of the problems with this traditional
Hilbert transformer is that the passband gain in H_{2}(w) is not unity for all frequencies, as is
the x'_{r}(n) path in Figure 912. So to minimize errors, we must
use many h_{2}(k) coefficients (or window the
coefficients) to make H_{2}(w)'s passband as flat as possible.
Although not shown here, the negative slope of
the phase response of H_{2}(w) corresponds to a filter group delay of G =
(14–1)/2 = 6.5 samples. This requires us to delay the original
x_{r}(n) sequence by a noninteger
(fractional) number of samples in order to achieve time alignment
with x_{i}(n). Fractional time delay filters is
beyond the scope of this material, but Reference [4] is
a source of further information on the topic.
Let's recall that alternate coefficients of a
Type III (oddtap) FIR are zeros. Thus the oddtap Hilbert
transformer is more attractive than an eventap version from a
computational workload standpoint. Almost half of the
multiplications in Figure
910 can be eliminated for a Type III FIR Hilbert transformer.
Designers might even be able to further reduce the number of
multiplications by a factor of two by using the folded FIR structure (discussed in Section
13.7) that's possible with symmetric coefficients (keeping in
mind that half the coefficients are negative).
A brief warning: here's a mistake sometimes even
the professionals make. When we
design standard linearphase FIR filters, we calculate the
coefficients and then use them in our hardware or software designs.
Sometimes we forget to flip the
coefficients before we use them in an FIR filter. This
forgetfulness usually doesn't hurt us because typical FIR
coefficients are symmetrical. Not so with FIR Hilbert filters, so
please don't forget to reverse the order of your coefficients
before you use them for convolutional filtering. Failing to flip
the coefficients will distort the desired HT phase response.
As an aside, Hilbert transformers can be built
with IIR filter structures, and in some cases they're more
computationally efficient than FIR Hilbert transformers at the
expense of a slight degradation in the 90^{o} phase
difference between x_{r}(n) and x_{i}(n)[5,6].
9.4.2 FrequencyDomain Hilbert
Transformation
Here's a frequencydomain Hilbert processing
scheme deserving mention because the HT of x_{r}(n) and the analytic x_{c}(n) sequence can be generated
simultaneously. We merely take an Npoint DFT of a real evenlengthN x_{r}(n) signal sequence, obtaining the
discrete X_{r}(m) spectrum given in Figure 914(a). Next, create a new spectrum
X_{c}(m) = 2X_{r}(m). Set the negativefrequency X_{c}(m) samples, that's (N/2)+1 m N–1, to zero leaving us with a new
onesided X_{c}(m) spectrum as in Figure 914(b). Next divide the X_{c}(0) (the DC term) and the
X_{c}(N/2) spectral samples by two. Finally,
we perform an Npoint inverse DFT
of the new X_{c}(m), the result being the desired
analytic x_{c}(n) timedomain sequence. The real part
of x_{c}(n) is the original x_{r}(n), and the imaginary part of x_{c}(n) is the HT of x_{r}(n). Done!
Figure 914. Spectrum of original x_{r}(n) sequence, and the onesided spectrum
of analytic x_{c}(n) sequence.
There are several issues to keep in mind
concerning this straightforward frequencydomain analytic signal
generation scheme:

If possible, restrict the x_{r}(n) input sequence length to an integer
power of two so the radix2 FFT algorithm can be used to
efficiently compute the DFT.

Make sure the X_{c}(m) sequence has the same length as the
original X_{r}(m) sequence. Remember, you zero out the
negativefrequency X_{c}(m) samples; you don't discard them.

The factor of 2 in the above X_{c}(m) = 2X_{r}(m) assignment compensates for the
amplitude loss by a factor of 2 in losing the negativefrequency
spectral energy.

If your HT application is blockoriented in the
sense that you only have to generate the analytic sequence from a
fixedlength real time sequence, this technique is sure worth
thinking about because there's no time delay heartache associated
with timedomain FIR implementations to worry about. With the
advent of fast hardware DSP chips and pipelined FFT techniques, the
above analytic signal generation scheme may be viable for a number
of applications. One scenario to consider is using the efficient
2Npoint real FFT technique,
described in Section
13.5.2, to compute the forward DFT of the realvalued x_{r}(n). Of course, the thoughtful engineer
would conduct a literature search to see what algorithms are
available for efficiently performing inverse FFTs when many of the
frequencydomain samples are zeros.
Should you desire a decimatedbytwo analytic
x'_{c}(n) sequence based on x_{r}(n), it's easy to do, thanks to Reference
[7].
First, compute the Npoint X_{r}(m). Next, create a new spectral sequence
X'_{c}(k) = 2X_{r}(k) for 1 k (N/2)1. Set X'_{c}(0) equal to X_{r}(0) + X_{r}(N/2). Finally, compute the (N/2)point inverse DFT of X'_{c}(m) yielding the decimatedbytwo
analytic x'_{c}(n). The x'_{c}(n) sequence has a sample rate of f'_{s} = f_{s}/2, and the spectrum shown
in Figure 914(c).
In Section
13.28.2 we discuss a scheme to generate interpolated analytic
signals from x_{r}(n).
