DSPRelated.com
Forums

Hilbert transformer for envelope detection

Started by Martin Trummer January 8, 2014
On Wed, 08 Jan 2014 12:27:26 -0500
robert bristow-johnson <rbj@audioimagination.com> wrote:

> On 1/8/14 12:21 PM, Martin Trummer wrote: > > On 2014-01-08 17:12:38 +0000, robert bristow-johnson said: > > > >> as i recall, the solution is to design a virtual all-pass filter with > >> a phase shift of -45 degrees (plus the delay necessary to realize it). > >> flip the coefs around and you have the +45 degree filter (with the > >> same delay) and the outputs of those two filters are always 90 degrees > >> apart and at *every* frequency, their gain is the same. ripple or not. > > > > Is that the the paper by Clay Turner? > > i think Clay wrote something like that. i cannot completely remember. > Clay's pretty smart, so i wouldn't doubt it. >
You thinking of www.claysturner.com/dsp/ASG.pdf&lrm; ? One of those papers I keep conveniently bookmarked. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.
radams2000@gmail.com writes:

> What is the frequency of X? It might be outside the frequency range > where the Hilbert filter can maintain flat amplitude response (the > filter response must go to 0 at DC and Fs/2). In that case the filter > output and the delay output are not equal in amplitude and the ripple > will not cancel. Might need a longer filter, or a parallel-allpass > approach. > > Or maybe the passband ripple spec you fed into fdatool was too large. > > Bob
Speaking of Hilbert transform filter design, what's wrong with this procedure: 1. Design a lowpass filter with your desired criteria (ripple, bandwidth / 2, etc.). 2. Mix it up by bandwidth / 2 using a complex sinusoid. ? This should get you a pair of filters, one for real and one for for imaginary. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Martin Trummer <m.trummer@nospam.org> writes:

> On 2014-01-08 17:12:38 +0000, robert bristow-johnson said: > >> as i recall, the solution is to design a virtual all-pass filter >> with a phase shift of -45 degrees (plus the delay necessary to >> realize it). flip the coefs around and you have the +45 degree >> filter (with the same delay) and the outputs of those two filters >> are always 90 degrees apart and at *every* frequency, their gain is >> the same. ripple or not. > > Is that the the paper by Clay Turner? I will try that. I just > recognized that my sine wave is close to 0 in relation to fs. (4 vs > 1000 Hz).
Yeah, as Robert said, woops! Can you post your coefficients and give the frequency of your damped sinusoid so we can check it out? -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Randy Yates <yates@digitalsignallabs.com> writes:

> Martin Trummer <m.trummer@nospam.org> writes: > >> On 2014-01-08 17:12:38 +0000, robert bristow-johnson said: >> >>> as i recall, the solution is to design a virtual all-pass filter >>> with a phase shift of -45 degrees (plus the delay necessary to >>> realize it). flip the coefs around and you have the +45 degree >>> filter (with the same delay) and the outputs of those two filters >>> are always 90 degrees apart and at *every* frequency, their gain is >>> the same. ripple or not. >> >> Is that the the paper by Clay Turner? I will try that. I just >> recognized that my sine wave is close to 0 in relation to fs. (4 vs >> 1000 Hz). > > Yeah, as Robert said, woops! > > Can you post your coefficients and give the frequency of your damped > sinusoid so we can check it out?
Doh! ... -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
One advantage of directly optimizing allpass filters is that you can focus your attention on maintaining phase only over the freqs you care about. The fir Hilbert filter is symmetric about PI/2 so if you only care about some low frequency F then you waste a lot of MIPS holding phase at PI - F. 

Bob
On 2014-01-08 18:01:09 +0000, radams2000@gmail.com said:

> One advantage of directly optimizing allpass filters is that you can > focus your attention on maintaining phase only over the freqs you care > about. The fir Hilbert filter is symmetric about PI/2 so if you only > care about some low frequency F then you waste a lot of MIPS holding > phase at PI - F. > Bob
How to design allpasses using Matlab? You mentioned an optimizer tool in Matlab? Yeas my region of interest is limited. It's only to 50 Hz. Martin
radams2000@gmail.com writes:

> One advantage of directly optimizing allpass filters is that you can > focus your attention on maintaining phase only over the freqs you care > about. The fir Hilbert filter is symmetric about PI/2 so if you only > care about some low frequency F then you waste a lot of MIPS holding > phase at PI - F.
Bob, Couldn't you do a similar optimization using the procedure I outlined by just specifying a smaller bandwidth and correspondingly-higher transition band? -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Randy,

This approach is certainly doable as long as you can design the low pass filter. What if you needed 10,000 taps?  The following paper shows how to do this and the needed constraints to do it cleanly.


A. Reilly, G. Frazer, and B. Boashash, &#4294967295;Analytic
signal generation&#4294967295;Tips and traps,&#4294967295; IEEE Trans.
Signal Processing, vol. 42, no. 11, Nov. 1994, pp.
3241&#4294967295;3245.
On Wednesday, January 8, 2014 12:21:21 PM UTC-5, Martin Trummer wrote:
> On 2014-01-08 17:12:38 +0000, robert bristow-johnson said: > > > > > as i recall, the solution is to design a virtual all-pass filter with a > > > phase shift of -45 degrees (plus the delay necessary to realize it). > > > flip the coefs around and you have the +45 degree filter (with the same > > > delay) and the outputs of those two filters are always 90 degrees apart > > > and at *every* frequency, their gain is the same. ripple or not. > > > > Is that the the paper by Clay Turner? I will try that. I just > > recognized that my sine wave is close to 0 in relation to fs. (4 vs > > 1000 Hz). > > > > Martin
Hello Martin, Yes that is pretty much what I put in my paper plus I designed a band pass filter where the impulse response is available as a formula, thus letting you design very long filters without numerical issues within a filter design program. If the specification has certain symmetries, nearly half of the filter coefs are zero. Clay
On Wednesday, January 8, 2014 12:27:26 PM UTC-5, robert bristow-johnson wrote:
> On 1/8/14 12:21 PM, Martin Trummer wrote: > > > On 2014-01-08 17:12:38 +0000, robert bristow-johnson said: > > > > > >> as i recall, the solution is to design a virtual all-pass filter with > > >> a phase shift of -45 degrees (plus the delay necessary to realize it). > > >> flip the coefs around and you have the +45 degree filter (with the > > >> same delay) and the outputs of those two filters are always 90 degrees > > >> apart and at *every* frequency, their gain is the same. ripple or not. > > > > > > Is that the the paper by Clay Turner? > > > > i think Clay wrote something like that. i cannot completely remember. > > Clay's pretty smart, so i wouldn't doubt it. > > > > > I will try that. I just recognized > > > that my sine wave is close to 0 in relation to fs. (4 vs 1000 Hz). > > > > that might kill you to. > > > > but, in any case, make awful damn sure you get your delays lined up. > > even being off by a sample or a half sample could get you the result > > you're seeing. > > > > > > -- > > > > r b-j rbj@audioimagination.com > > > > "Imagination is more important than knowledge."
I don't know if I'd call myself smart. Basically the way I came up with the idea of using two 45 deg filters with one being the time reversal of the other was as follows: "I was standing on the edge of my toilet hanging a clock, the porcelain was wet, I slipped, hit my head on the sink, and when I came to I had a revelation! A vision! A picture in my head! A picture of this!" Clay with a little license from Dr Emmitt Brown.