For an ultrasound application, I am collecting data from an ADC using high spec Altera FPGA which grabs data and can then do some DSP processing that would be otherwise too slow for a desktop to do.

Part of the DSP required is the precursor to envelope detection. The incoming signals from the ADC contain only the in-phase component of the signal. As a result I also need to generate the quadrature component to be able to then do the sum of squares of I/Q to get the envelope. To get the Q component a Hilbert FIR filter is called for.

Using MATLAB I've been able to design a suitable Hilbert filter for the application. However there are limited resources, so the filter is limited in terms of taps. Using the "Altera FIR Compiler II" tool I've then generated the filter for the FPGA.

I've been doing some simulation and the filter does correctly produce the quadrature component - for example if I feed in a sine I get a cosine. The trouble is the filter causes an attenuation of the signal - i.e. it isn't unity gain. Part of this will be due to coefficient rounding, and part of it due to the calculations being done in fixed point.

Using this filter if I try to do envelope detection using sum of squares, the resulting envelope is not brilliant. in the sine/cosine example I would expect the result to be a DC level, however it is in fact a DC level with a sine wave floating on it. This is presumably due to the Q signal being slightly attenuated. In fact if I multiply all the I values by a constant scalar found by trial and error, the envelope improves in accuracy.

The trouble is the pass band of the Hilbert filter isn't perfectly flat, there are <0.1dB ripples in it - there is a limitation on the number of taps I can implement due to resource restrictions. As a result the envelope of signals that are not pure tones get distorted again because my scalar for the I data is perfectly flat (its a simple multiplication).

What I am wondering then is can I improve the envelope by using a FIR filter on the I data as well. Rather than just delaying the I data and multiplying it by a constant scale factor, is it possible to design a FIR filter whose pass band response is matched to the Hilbert filter? If so, is there a simple way to do it using MATLAB?

  • $\begingroup$ Have you analyzed the frequency response of your filter, taking the quantization of coefficients and fixed-point arithmetic into account? This isn't a trivial procedure, but if you have the MATLAB Fixed-Point Toolbox, it will do it for you. < 0.1 dB ripple is pretty good; I don't have any expertise in the ultrasound imaging subfield, but I would be surprised if that level of ripple is causing any noticeable performance degradation. $\endgroup$
    – Jason R
    May 5, 2016 at 2:03

1 Answer 1


Clay Turner has an interesting couple of papers.

what you want to do is compute (using MATLAB firpm() or firls()) two filters that shift the phase, one at -45° and the other at +45° relative to some linear phase angle that corresponds to a constant delay. you design one and then flip the coefficients around for the other. they will both have the same magnitude frequency response and be 90° out of phase of each other for every frequency.

  • $\begingroup$ Nice; I forgot about that paper. It's a pretty brilliant approach if you ask me. Clay's approaches usually are. $\endgroup$
    – Jason R
    May 5, 2016 at 2:07
  • $\begingroup$ Very interesting approach. I'll have give those papers a thorough reading, but on the face of it, it makes a great deal of sense. $\endgroup$ May 5, 2016 at 2:10
  • $\begingroup$ I've implemented the filters based on the equation from the first paper you posted and it seems to be working well. I get two signals 90 degrees apart and at exactly the same amplitude. $\endgroup$ May 6, 2016 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.