# Evelope detection using Hilbert transformer and carrier ripple

Started by April 7, 2005
```I have a question about envelope detection.  I am an "analog"  guy
trying to understand the advantage of using the Hilbert transformer
(HT) method for obtaining the envelope of a carrier signal.

I have read that the standard DSP approach is to use a Hilbert
transformer (HT) to create a 90 deg shifted version of the carrier
then:

envelope = sqrt (I^2+Q^2)

Does the output of this contain ripple at 4x the carrier frequency?

I know that "simply" taking the absolute value or squaring the carrier
results in an envelope signal that contains ripple at 2x (and above)
the carrier frequency.

I know that "simple" half wave rectification contains ripple at 1X (and
above) the carrier frequency.

So is it true that the HT method still requires low pass filtering to
remove the 4x carrier component but that  the HT method is considered
better because the  4x carrier component is easier to filter (remove)
than a 2x or 1x component?

thanks
Mark

```
```spelling correction

```
```Mark wrote:
> I have a question about envelope detection.  I am an "analog"  guy
> trying to understand the advantage of using the Hilbert transformer
> (HT) method for obtaining the envelope of a carrier signal.
>
> I have read that the standard DSP approach is to use a Hilbert
> transformer (HT) to create a 90 deg shifted version of the carrier
> then:
>
>          envelope = sqrt (I^2+Q^2)
>
> Does the output of this contain ripple at 4x the carrier frequency?
>
> I know that "simply" taking the absolute value or squaring the
carrier
> results in an envelope signal that contains ripple at 2x (and above)
> the carrier frequency.
>
> I know that "simple" half wave rectification contains ripple at 1X
(and
> above) the carrier frequency.
>
> So is it true that the HT method still requires low pass filtering to
> remove the 4x carrier component but that  the HT method is considered
> better because the  4x carrier component is easier to filter (remove)
> than a 2x or 1x component?
>
> thanks
> Mark

This method will not produce harmonics. One thing that is often done is
to multiply the carrier wave with exp(-j*2*pi*Fc*t), then lowpass
filter and decimate to reduce the number of magnitude calculations per
second and limit the noise bandwidth. Next a smoothing filter can be
applied to the magnitude result.

John

```
```Hi Mark,

this type of amplitude demodulation or amplitude detection is one of the
very few methods that needs NO lowpass fltering because it generates NO
ripple on whatever frequency. And it is very easy to see why:

Consider your carrier (the In-phase signal) being A*Sin(w*t). Then your
Q(uadrature) signal is A*Cos(w*t). Now compute  sqrt (I^2+Q^2):

sqrt(A^2*Sin^2(w*t)+A^2*Cos^2(w*t)) = A*sqrt(Sin^2(w*t)+Cos^2(w*t))

The next step is to see that Sin^2(Something)+Cos^2(Something) can be
reduced to "1" if you consider Phytagoras's law A^2+B^2=C^2 being applied to
a rectangle triangle with a hypotenusis of length "1".

Therefore A*sqrt(Sin^2(w*t)+Cos^2(w*t)) = A, no matter what w*t is.

Regards
Ulrich

"Mark" <makolber@yahoo.com> schrieb im Newsbeitrag
> I have a question about envelope detection.  I am an "analog"  guy
> trying to understand the advantage of using the Hilbert transformer
> (HT) method for obtaining the envelope of a carrier signal.
>
> I have read that the standard DSP approach is to use a Hilbert
> transformer (HT) to create a 90 deg shifted version of the carrier
> then:
>
>          envelope = sqrt (I^2+Q^2)
>
> Does the output of this contain ripple at 4x the carrier frequency?
>
> I know that "simply" taking the absolute value or squaring the carrier
> results in an envelope signal that contains ripple at 2x (and above)
> the carrier frequency.
>
> I know that "simple" half wave rectification contains ripple at 1X (and
> above) the carrier frequency.
>
> So is it true that the HT method still requires low pass filtering to
> remove the 4x carrier component but that  the HT method is considered
> better because the  4x carrier component is easier to filter (remove)
> than a 2x or 1x component?
>
> thanks
> Mark
>

```
```Ulrich

Thanks... yes I see now how the 90 deg shifted signals add to produce a
flat envelope with no ripple.

Wonderful !!!!

I like it when there is a truly elegant solution to a problem.

thanks

Mark

```
```On 11 Apr 2005 06:48:44 -0700, "Mark" <makolber@yahoo.com> wrote:

>Ulrich
>
>Thanks... yes I see now how the 90 deg shifted signals add to produce a
>flat envelope with no ripple.
>
>Wonderful !!!!
>
>I like it when there is a truly elegant solution to a problem.
>
>thanks
>
>Mark

Hi Mark,

you've received some terrific replies here.

The darned problem is that to compute the
Hilbert transform requires a fair amount of processing.
The wider your signal bandwidth, the more
computations you must perform.  Once you have the
I & Q samples, you square them, add the
products, and then ya' have to perform a
dog-gone square root.

Now, ... there are several algorithms for
estimating the magnitude of a complex sample,
in a fairly efficient way, if you can
tolerate a few percent error in your
magnitude result.  Ya' might take a look
at the March 2005 "DSP Tips & Tricks" column
of the IEEE Signal Processing magazine.
It's a good article on this exact topic.

I just ran across an AM demod algorithm
that operates on real-only signals
(no HT required), but the signal must
be narrowband and centered exactly at 1/4th
the sample rate, and it also requires
a square root operation.

Good Luck,
[-Rick-]

```
```R.Lyons@_BOGUS_ieee.org (Rick Lyons) wrote in news:425d221a.45744156
@news.sf.sbcglobal.net:

> On 11 Apr 2005 06:48:44 -0700, "Mark" <makolber@yahoo.com> wrote:
>
>>Ulrich
>>
>>Thanks... yes I see now how the 90 deg shifted signals add to produce a
>>flat envelope with no ripple.
>>
>>Wonderful !!!!
>>
>>I like it when there is a truly elegant solution to a problem.
>>
>>thanks
>>
>>Mark
>
> Hi Mark,
>
>   you've received some terrific replies here.
>
> The darned problem is that to compute the
> Hilbert transform requires a fair amount of processing.
> The wider your signal bandwidth, the more
> computations you must perform.  Once you have the
> I & Q samples, you square them, add the
> products, and then ya' have to perform a
> dog-gone square root.
>
> Now, ... there are several algorithms for
> estimating the magnitude of a complex sample,
> in a fairly efficient way, if you can
> tolerate a few percent error in your
> magnitude result.  Ya' might take a look
> at the March 2005 "DSP Tips & Tricks" column
> of the IEEE Signal Processing magazine.
> It's a good article on this exact topic.
>
> I just ran across an AM demod algorithm
> that operates on real-only signals
> (no HT required), but the signal must
> be narrowband and centered exactly at 1/4th
> the sample rate, and it also requires
> a square root operation.
>
> Good Luck,
> [-Rick-]
>
>
>
>
>
>

Something to consider....

A lot of times you can use an envelope detector to determine if a signal
is present or above a certain level. In this case, you can skip the
square root function. Furthermore, if your signal is far enough from the
band edge (DC for example), the hilbert filter can be fairly short. This
makes it fairly inexpensive to implement from a computation point of
view.

The catch to the hilbert filter is that its magnitude response will have
ripple (in the passband). This means that even though the phase is
separated by 90 degrees, the magnitude squared calculation (I^2 + R^2) is
not exact. You can improve the magnitude response with a larger filter.

No doubt, everything I just said is in Rick's excellent book. Buy the
second edition! (I have a copy of both)

--
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
```
```On Mon, 18 Apr 2005 21:57:38 GMT, Al Clark <dsp@danvillesignal.com>
wrote:

(snipped)
>
>Something to consider....
>
>A lot of times you can use an envelope detector to determine if a signal
>is present or above a certain level. In this case, you can skip the
>square root function. Furthermore, if your signal is far enough from the
>band edge (DC for example), the hilbert filter can be fairly short. This
>makes it fairly inexpensive to implement from a computation point of
>view.
>
>The catch to the hilbert filter is that its magnitude response will have
>ripple (in the passband). This means that even though the phase is
>separated by 90 degrees, the magnitude squared calculation (I^2 + R^2) is
>not exact. You can improve the magnitude response with a larger filter.
>
>No doubt, everything I just said is in Rick's excellent book. Buy the
>second edition! (I have a copy of both)
>
>
>--
>Al Clark

Hi Al,

dog gone it.  I sure wish you'd write
an article for the "DSP Tips & Tricks" column of the
IEEE Signal Processing magazine.

See Ya',
[-Rick-]

```
```On Tue, 19 Apr 2005 05:04:07 +0000, Rick Lyons wrote:

> On Mon, 18 Apr 2005 21:57:38 GMT, Al Clark <dsp@danvillesignal.com>
> wrote:
>
>   (snipped)
>>
>>Something to consider....
>>
>>A lot of times you can use an envelope detector to determine if a signal
>>is present or above a certain level. In this case, you can skip the
>>square root function. Furthermore, if your signal is far enough from the
>>band edge (DC for example), the hilbert filter can be fairly short. This
>>makes it fairly inexpensive to implement from a computation point of
>>view.
>>
>>The catch to the hilbert filter is that its magnitude response will have
>>ripple (in the passband). This means that even though the phase is
>>separated by 90 degrees, the magnitude squared calculation (I^2 + R^2) is
>>not exact. You can improve the magnitude response with a larger filter.
>>
>>No doubt, everything I just said is in Rick's excellent book. Buy the
>>second edition! (I have a copy of both)
>>
>>
>>--
>>Al Clark
>
> Hi Al,
>
>   dog gone it.  I sure wish you'd write
> an article for the "DSP Tips & Tricks" column of the
> IEEE Signal Processing magazine.

There's a "Tips and Tricks" article [letter] on this subject (sort of) in
IEEE TAS around '94 (by yours truly et al) and a summary of same in the
comp.dsp faq.

Related to Al's point:

You don't *have* to have a ripply pass-band.  It's just a filter design
problem: you can opt for a maximally flat response if you like, by using
the appropriate design rules.  The Hilbert filter (particularly one that
doesn't attempt to stretch all the way to the frequency limits) is just a
modulated low-pass filter, and you can design any low-pass filter that you
like.

Cheers,

--
Andrew

```
```Andrew Reilly <andrew-newspost@areilly.bpc-users.org> wrote in
news:pan.2005.04.19.05.38.47.404944@areilly.bpc-users.org:

> On Tue, 19 Apr 2005 05:04:07 +0000, Rick Lyons wrote:
>
>> On Mon, 18 Apr 2005 21:57:38 GMT, Al Clark <dsp@danvillesignal.com>
>> wrote:
>>
>>   (snipped)
>>>
>>>Something to consider....
>>>
>>>A lot of times you can use an envelope detector to determine if a
>>>signal is present or above a certain level. In this case, you can
>>>skip the square root function. Furthermore, if your signal is far
>>>enough from the band edge (DC for example), the hilbert filter can be
>>>fairly short. This makes it fairly inexpensive to implement from a
>>>computation point of view.
>>>
>>>The catch to the hilbert filter is that its magnitude response will
>>>have ripple (in the passband). This means that even though the phase
>>>is separated by 90 degrees, the magnitude squared calculation (I^2 +
>>>R^2) is not exact. You can improve the magnitude response with a
>>>larger filter.
>>>
>>>No doubt, everything I just said is in Rick's excellent book. Buy the
>>>second edition! (I have a copy of both)
>>>
>>>
>>>--
>>>Al Clark
>>
>> Hi Al,
>>
>>   dog gone it.  I sure wish you'd write
>> an article for the "DSP Tips & Tricks" column of the
>> IEEE Signal Processing magazine.
>
> There's a "Tips and Tricks" article [letter] on this subject (sort of)
> in IEEE TAS around '94 (by yours truly et al) and a summary of same in
> the comp.dsp faq.
>
> Related to Al's point:
>
> You don't *have* to have a ripply pass-band.  It's just a filter
> design problem: you can opt for a maximally flat response if you like,
> by using the appropriate design rules.  The Hilbert filter
> (particularly one that doesn't attempt to stretch all the way to the
> frequency limits) is just a modulated low-pass filter, and you can
> design any low-pass filter that you like.
>
> Cheers,
>

I agree that you can have very small ripple in the passband. The implied
point that I was trying to make is that even though the phase is perfect,
the magnitude is never quite perfect. Obviously, outside the band edges
the magnitude calculation falls apart.

The filter needs to be long if you want to extend to low frequencies.
This is fairly obvious if you think about how much delay you would need
to shift "DC" by 90 degrees.

--
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
```