DSPRelated.com
Forums

Envelope Detection

Started by HelpmaBoab March 30, 2006
I have read that to get the envelope of a signal we can take its Hilbert TF
and use this as the imaginary part of a complex array (the real part being
the original signal). Then the envelope is sqrt(re^2 + im^2). I imagine this
is just creating an I and Q. How accurate is this method and can we use an
FFT (s) to do the Hilbert transform?


Tam


HelpmaBoab wrote:
> I have read that to get the envelope of a signal we can take its Hilbert TF > and use this as the imaginary part of a complex array (the real part being > the original signal). Then the envelope is sqrt(re^2 + im^2). I imagine this > is just creating an I and Q. How accurate is this method
As accurate as the arithmetic, provided you don't need too much bandwidth, and what you do need is centered near Fs/4.
> and can we use an FFT (s) to do the Hilbert transform?
You use an FIR to do the transform. FIRs can be implemented with FFTs. http://www.nauticom.net/www/jdtaft/hilbert.htm is an aplet that will design FIRs up to 35 taps. You may need more than that. The shortest HT has coefficients -1/2 0 +1/2. Like all HTs, it has 90-degree phase at all frequencies and is a decent differentiator up to Fs/10 or so. Odd numbers of taps have the advantage that the properly delayed in-phase signal is available at the middle tap. Such filters make sense only when N = 4K-1, k integer. the design will usually need to be windowed. In order not to waste the end coefficients, calculate the window for 4k+1 if it tapers to zero at the ends. I like Nuttall for this.) I design them by designating the center tap a[0], the first tap a[-(N-1)/2], and the last tap a[(N-1)/2] set the even-numbered taps to zero and the odd-numbered taps a[n]=1/n including the sign of n. Scale the filter by dividing each coefficient by the sum of the absolute values of all of them (or twice the sum of the positive ones). Do the scaling after windowing to make the gain exactly 0 dB at Fs/4 or before windowing to make the peak gain near 0 dB. Accuracy suffers because there is ripple in the Q data but not I. A long enough FIR and a good window overcome that. Another method uses I and Q complementary band-pass filter in which the ripples match, so long convolutions and good windows are less important. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
HelpmaBoab wrote:
> I have read that to get the envelope of a signal we can take its Hilbert TF > and use this as the imaginary part of a complex array (the real part being > the original signal). Then the envelope is sqrt(re^2 + im^2). I imagine this > is just creating an I and Q. How accurate is this method
As accurate as the arithmetic, provided you don't need too much bandwidth, and what you do need is centered near Fs/4.
> and can we use an FFT (s) to do the Hilbert transform?
You use an FIR to do the transform. FIRs can be implemented with FFTs. http://www.nauticom.net/www/jdtaft/hilbert.htm is an aplet that will design FIRs up to 35 taps. You may need more than that. The shortest HT has coefficients -1/2 0 +1/2. Like all HTs, it has 90-degree phase at all frequencies and is a decent differentiator up to Fs/10 or so. Odd numbers of taps have the advantage that the properly delayed in-phase signal is available at the middle tap. Such filters make sense only when N = 4K-1, k integer. the design will usually need to be windowed. In order not to waste the end coefficients, calculate the window for 4k+1 if it tapers to zero at the ends. (I like Nuttall for this.) I design them by designating the center tap a[0], the first tap a[-(N-1)/2], and the last tap a[(N-1)/2] set the even-numbered taps to zero and the odd-numbered taps a[n]=1/n including the sign of n. Scale the filter by dividing each coefficient by this sum: change the sign of alternate non-zero coefficients and add them. Do the scaling after windowing to make the gain exactly 0 dB at Fs/4 or before windowing to make the peak gain near 0 dB. Accuracy suffers because there is ripple in the Q data but not I. A long enough FIR and a good window overcome that. Another method uses I and Q complementary band-pass filter in which the ripples match, making long convolutions and low-ripple windows less important. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Jerry Avins <jya@ieee.org> wrote in news:grmdncbz78-W6LbZRVn-qQ@rcn.net:

> HelpmaBoab wrote: >> I have read that to get the envelope of a signal we can take its >> Hilbert TF and use this as the imaginary part of a complex array (the >> real part being the original signal). Then the envelope is sqrt(re^2 >> + im^2). I imagine this is just creating an I and Q. How accurate is >> this method > > As accurate as the arithmetic, provided you don't need too much > bandwidth, and what you do need is centered near Fs/4. > >> and can we use an FFT (s) to do the Hilbert transform? > > You use an FIR to do the transform. FIRs can be implemented with FFTs. > > http://www.nauticom.net/www/jdtaft/hilbert.htm is an aplet that will > design FIRs up to 35 taps. You may need more than that. The shortest > HT has coefficients -1/2 0 +1/2. Like all HTs, it has 90-degree phase > at all frequencies and is a decent differentiator up to Fs/10 or so. > > Odd numbers of taps have the advantage that the properly delayed > in-phase signal is available at the middle tap. Such filters make > sense only when N = 4K-1, k integer. the design will usually need to > be windowed. In order not to waste the end coefficients, calculate the > window for 4k+1 if it tapers to zero at the ends. (I like Nuttall for > this.) I design them by designating the center tap a[0], the first tap > a[-(N-1)/2], and the last tap a[(N-1)/2] set the even-numbered taps to > zero and the odd-numbered taps a[n]=1/n including the sign of n. Scale > the filter by dividing each coefficient by this sum: change the sign > of alternate non-zero coefficients and add them. Do the scaling after > windowing to make the gain exactly 0 dB at Fs/4 or before windowing to > make the peak gain near 0 dB. > > Accuracy suffers because there is ripple in the Q data but not I. A > long enough FIR and a good window overcome that.
I take no issue with any of the above comments. I just used this structure in a custom modem. The signals were near fs/4 so the hilbert used only 11 taps and 5 were 0 and therefore safely ignored. I would suggest Rick Lyons book (Understanding Digital Signal processing , 2nd Ed) for a good description of the method above. Another method uses I
> and Q complementary band-pass filter in which the ripples match, > making long convolutions and low-ripple windows less important. >
This method doesn't necessarily work any better in my view since the ripple will still cause I^2 + Q^2 to vary from ideal. In most cases the FIR method outlined first is the easiest to implement. I use Kaiser windows but I think I will look into the Nuttall window that you mention. Other Comments: If I need a Hilbert transform that extends over a very large frequency range, I use remez exchange to minimize the ripple. The catch is that you don't get to throw out every other coefficient since in general, all the coefficients are non zero. I think that sometimes people forget that it takes a very long filter to create a 90 degree phase shift at low frequency. It's easy to visualize why if you think about how to create a 90 degree phase shift at DC. The other thing that I find is that in many cases I actually don't need the envelope, I just need the mean squared (I^2 + Q^2) vs SQRT(I^2 + Q^ 2). In a detector, I might just compare the result to some arbitrary level. This means I can skip the SQRT. -- Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
"HelpmaBoab" <FU2@yahoo.co.zpc> wrote in message
news:KNIWf.9563$JZ1.355822@news.xtra.co.nz...
> I have read that to get the envelope of a signal we can take its Hilbert
TF
> and use this as the imaginary part of a complex array (the real part being > the original signal). Then the envelope is sqrt(re^2 + im^2). I imagine
this
> is just creating an I and Q. How accurate is this method and can we use an > FFT (s) to do the Hilbert transform? > > > Tam > >
What do you mean by envelope detection? AM demodulation? If you have baseband I,Q data you can just run it through a cordic function (or do sqrt(I^2+Q^2)). The hilbert transform seperates the positive frequencies from the negative frequencies in a complex signal. I don't see how it would apply to envelope detection? -Clark
Al Clark wrote:

   ...

> If I need a Hilbert transform that extends over a very large frequency > range, I use remez exchange to minimize the ripple. The catch is that you > don't get to throw out every other coefficient since in general, all the > coefficients are non zero.
I concluded, from the few simulations I ran, that a filter with alternate zeros, while longer than an optimized filter of the same ripple, has fewer taps that need computing.* It isn't that multiplying by zero is easy; by marching through the data buffer with a stride of two, the zeros might as well not exist. Windows that best remove ripple reduce bandwidth the most, requiring more taps to get it back.
> I think that sometimes people forget that it takes a very long filter to > create a 90 degree phase shift at low frequency. It's easy to visualize > why if you think about how to create a 90 degree phase shift at DC.
I've had a computer tied up since New Years calculating a filter to do that. :-)
> The other thing that I find is that in many cases I actually don't need > the envelope, I just need the mean squared (I^2 + Q^2) vs SQRT(I^2 + Q^ > 2). In a detector, I might just compare the result to some arbitrary > level. This means I can skip the SQRT.
I've seen programs that calculate the square root and then convert to decibels. Jerry ___________________________ * "My mind is made up. Don't confuse me with facts" -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Anonymous wrote:

   ...

> The hilbert transform seperates the positive frequencies from the negative > frequencies in a complex signal. I don't see how it would apply to envelope > detection?
You are misinformed. By generating Q from I, an HT can be part of the procedure for separating positive from negative frequencies. (The phasing method of single-sideband suppressed-carrier modulation.) Do you need references? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Anonymous wrote:
> "HelpmaBoab" <FU2@yahoo.co.zpc> wrote in message > news:KNIWf.9563$JZ1.355822@news.xtra.co.nz... >> I have read that to get the envelope of a signal we can take its Hilbert > TF >> and use this as the imaginary part of a complex array (the real part being >> the original signal). Then the envelope is sqrt(re^2 + im^2). I imagine > this >> is just creating an I and Q. How accurate is this method and can we use an >> FFT (s) to do the Hilbert transform? >> >> >> Tam >> >> > > What do you mean by envelope detection? AM demodulation? > > If you have baseband I,Q data you can just run it through a cordic function > (or do sqrt(I^2+Q^2)). > > The hilbert transform seperates the positive frequencies from the negative > frequencies in a complex signal. I don't see how it would apply to envelope > detection? > > -Clark > >
When you inverse transform the positive frequencies the original real signal s(t), becomes a complex signal. Most books call this the analytic signal. The magnitude of the complex signal is usually taken to be the envelope.
"Jerry Avins" <jya@ieee.org> wrote in message
news:j4CdnQyWfeXAZ7bZnZ2dnUVZ_tWdnZ2d@rcn.net...
> Anonymous wrote: > > ... > > > The hilbert transform seperates the positive frequencies from the
negative
> > frequencies in a complex signal. I don't see how it would apply to
envelope
> > detection? > > You are misinformed. By generating Q from I, an HT can be part of the > procedure for separating positive from negative frequencies. (The > phasing method of single-sideband suppressed-carrier modulation.) Do you > need references? > > Jerry > -- > Engineering is the art of making what you want from things you can get. > &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
I guess it's been a while. The only time I ever used HT was in a doppler ultrasound where the positve frequencies mapped to forward flow and the negative frequencies mapped to reverse flow. If I want to take the envelope of a signal I just mix it to baseband and run it through a cordic. As I recall the HT filters ended up pretty long to get good seperation from the pos/neg frequencies. Is there a computation advantage to HT versus my dumb way? -Clark
Anonymous wrote:

   ...

> I guess it's been a while. The only time I ever used HT was in a doppler > ultrasound where the positve frequencies mapped to forward flow and the > negative frequencies mapped to reverse flow. > > If I want to take the envelope of a signal I just mix it to baseband and run > it through a cordic. As I recall the HT filters ended up pretty long to get > good seperation from the pos/neg frequencies. Is there a computation > advantage to HT versus my dumb way?
A complex mix to baseband yields I and Q. An HT provides Q when only baseband I is available. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;