# Hilbert Transform from FFT?

For a school project, I'm working on a software-defined radio transmitter intended for the HF amateur radio bands. I'm planning to support SSB transmission with the formula

$$f(t) = m(t) \cos(2\pi f_\text{carrier}t) \pm \hat m(t)\sin(2\pi f_\text {carrier}t)$$

where $f_\text{carrier}$ is the IF carrier and $\hat m$ is the Hilbert transform of $m(t)$. Of course, I will use a discrete form of this equation for my implementation, which means I need to calculate the discrete Hilbert transform of $m(t)$.

I've looked around online but can't seem to find a decent C/C++ implementation of the discrete Hilbert transform that would be suitable for my purposes. However, there are plenty of libraries to calculate FFTs.

From my understanding, a discrete Hilbert transform can be calculated by taking the FFT of the signal and multiplying by j to achieve the 90° shift. It suffers from Gibbs' phenomenon, it seems, and might need a wide bandpass filter.

Can anyone tell me if my understanding is correct (or of a good discrete Hilbert transform function)?

• This code has a function that takes a real-only signal and generates its hilbert transform. See the function analytic. – Peter K. Feb 3 '16 at 22:20
• @wisner Try Googling Hilbert Transform Filters, or Hilbert Transform Software – user5108_Dan Feb 9 '16 at 16:47

## 1 Answer

I've looked around online but can't seem to find a decent C/C++ implementation of the discrete Hilbert transform that would be suitable for my purposes.

Can't completely agree to that, see links below.

So, a hilbert filter generates the analytical signal out of a real signal.

In fact, it's but a complex bandpass filter: It cancels out all the negative frequencies.

There's a lot of ways you can implement that (including GNU Radio's hilbert filter, source code, filter generation code), but you can imagine taking a symmetrical half-band low pass filter, and shifting it up for half the sampling rate, so that its passband now covers the positive frequencies.

Luckily, half-band filters are easy to produce and to implement; what is often done is that you take a prototype window, interpolate it by a factor 2 (adding zeros between the window taps), and weigh it, for example with 1/n (n=tap distance from center tap). The result works quite fine:  • Marcus, I appreciate your answer! I actually wound up implementing a less-complicated version with a FFT (see here: github.com/sawbg/radio/blob/master/src/zdomain.hpp), but your answer will help me a good deal with this transform in the future. I was needing the Hilbert transform in the final project for my MSEE, and I want you to know that I specifically listed you in the "Acknowledgements" section of my project report for the help you provided :) – wisner Apr 4 '16 at 17:23