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?