DSPRelated.com
Forums

Hilbert transformer for envelope detection

Started by Martin Trummer January 8, 2014
radams2000@gmail.com writes:

> On Wednesday, January 8, 2014 10:08:52 AM UTC-5, Martin Trummer wrote: >> Hi DSP-experts, >> >> >> >> I'm using a FIR hilbert-transformer (designed with Matlab's fdatool, >> >> 200 coefficients) for a envlope detection. For eg: >> >> >> >> % Signal is x, h contains coefficients of hilbert transforemer >> >> x_analytical = filter(h,1,x); >> >> x_delay = filter([zeros([1,99]), 1],1,x); >> >> envelope = sqrt(x_analytical.^2+x_delay.^2); >> >> >> >> My problem is that the envelope doesn't fit very well since there is a >> >> lot ringing on the envelope itself as you can see on the following >> >> screenshot: >> >> >> >> http://s14.directupload.net/images/140108/8cmreir2.png >> >> >> >> What's the exact problem for this behavior and how can this be avoided? >> >> Thank you in advance! >> >> >> >> Cheers Martin > > Sure. Basically you want to use two parallel allpass chains where the > phase difference between their outputs is 90 degrees over some > frequency range. You start by choosing 1st-order or 2nd-order sections > (if you need to get close to DC then 2nd-order might be better). The > phase of each allpass will start from from 0 degrees and go to 360 > degrees (for 2nd-order) so if you cascade them with frequencies offset > by some factor, you get a net phase curve that decreases continuously > with wiggles, over frequency. Generally, you want to construct the 2nd > chain with the center freqs of the allpass filters in between the > center freqs of the 1st chain. By plotting the unwrapped phase > difference you can manually wiggle the center freqs and Q's to get the > phase diff as close as possible to 90 degrees over the frequency range > of interest. You won't be able to do a very good job manually, but you > just want to get close enough the the optimizer won't fall into some > local minimum trap. > Then you write a function for the optimizer that returns an array of > phase errors over the desired frequency range, and give it the freedom > to adjust the allpass center freqs and Q's. Then hit return and go get > a cup of coffee. When you come back you will hopefully find that the > phase has equiripple errors around 90 degrees. It's not very hard to > get phase error numbers that are very small (hundredths of a degree). > It's also nice that you benefit from all the usual benefits of > allpass-based filters (coefficient sensitivity, etc).
PS: Bob, from your usenet client, did it appear that you were responding to me? My client indicates your response to Martin's original post. I've also noticed multiple times in the past that your responses don't line up with the person you're responding to. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
On 1/12/14 9:40 PM, Randy Yates wrote:
> radams2000@gmail.com writes: > >> On Wednesday, January 8, 2014 10:08:52 AM UTC-5, Martin Trummer wrote: >>> Hi DSP-experts, >>> >>> >>> >>> I'm using a FIR hilbert-transformer (designed with Matlab's fdatool, >>> >>> 200 coefficients) for a envlope detection. For eg: >>> >>> >>> >>> % Signal is x, h contains coefficients of hilbert transforemer >>> >>> x_analytical = filter(h,1,x); >>> >>> x_delay = filter([zeros([1,99]), 1],1,x); >>> >>> envelope = sqrt(x_analytical.^2+x_delay.^2); >>> >>> >>> >>> My problem is that the envelope doesn't fit very well since there is a >>> >>> lot ringing on the envelope itself as you can see on the following >>> >>> screenshot: >>> >>> >>> >>> http://s14.directupload.net/images/140108/8cmreir2.png >>> >>> >>> >>> What's the exact problem for this behavior and how can this be avoided? >>> >>> Thank you in advance! >>> >>> >>> >>> Cheers Martin >> >> Sure. Basically you want to use two parallel allpass chains where the >> phase difference between their outputs is 90 degrees over some >> frequency range. You start by choosing 1st-order or 2nd-order sections >> (if you need to get close to DC then 2nd-order might be better). The >> phase of each allpass will start from from 0 degrees and go to 360 >> degrees (for 2nd-order) so if you cascade them with frequencies offset >> by some factor, you get a net phase curve that decreases continuously >> with wiggles, over frequency. Generally, you want to construct the 2nd >> chain with the center freqs of the allpass filters in between the >> center freqs of the 1st chain. By plotting the unwrapped phase >> difference you can manually wiggle the center freqs and Q's to get the >> phase diff as close as possible to 90 degrees over the frequency range >> of interest. You won't be able to do a very good job manually, but you >> just want to get close enough the the optimizer won't fall into some >> local minimum trap. >> Then you write a function for the optimizer that returns an array of >> phase errors over the desired frequency range, and give it the freedom >> to adjust the allpass center freqs and Q's. Then hit return and go get >> a cup of coffee. When you come back you will hopefully find that the >> phase has equiripple errors around 90 degrees. It's not very hard to >> get phase error numbers that are very small (hundredths of a degree). >> It's also nice that you benefit from all the usual benefits of >> allpass-based filters (coefficient sensitivity, etc). > > PS: Bob, from your usenet client, did it appear that you were responding > to me? My client indicates your response to Martin's original post. I've > also noticed multiple times in the past that your responses don't line > up with the person you're responding to.
another thing, Bob, your blankity-blank lines are so blankity-blank long. i can't ever figure out why *my* client program doesn't wrap them. at least it ain't what plagues gyansorova's postings. each time anyone replies to his post, it doubles the number of lines, complete with the commenting ">" mark. what's happened to all these client programs? have they just gotten stupid or something? like since 2005? heaven knows that google.groups has become totally brain dead now. i remember when they took over for dejanews i thought google was so smart that they could never ever get dumb. maybe not, but like Microshit, they can lose good taste and all perspective of utility for their marked "client" (or "target" or krill or whatever we are to Google). -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Sorry, I usually respond on my iphone via google groups, can anyone suggest a way to improve this?

Bob
On 1/13/14 6:14 AM, radams2000@gmail.com wrote:
> Sorry, I usually respond on my iphone via google groups, can anyone suggest a way to improve this? >
i think trials where we make these crappy engineers and crappy managers and crappy designers account for their crappy software. complete with public firing squads. even televized. that'll improve it awful fast. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On Sun, 12 Jan 2014 21:40:26 -0500, Randy Yates
<yates@digitalsignallabs.com> wrote:

>radams2000@gmail.com writes: > >> On Wednesday, January 8, 2014 10:08:52 AM UTC-5, Martin Trummer wrote: >>> Hi DSP-experts, >>> >>> >>> >>> I'm using a FIR hilbert-transformer (designed with Matlab's fdatool, >>> >>> 200 coefficients) for a envlope detection. For eg: >>> >>> >>> >>> % Signal is x, h contains coefficients of hilbert transforemer >>> >>> x_analytical = filter(h,1,x); >>> >>> x_delay = filter([zeros([1,99]), 1],1,x); >>> >>> envelope = sqrt(x_analytical.^2+x_delay.^2); >>> >>> >>> >>> My problem is that the envelope doesn't fit very well since there is a >>> >>> lot ringing on the envelope itself as you can see on the following >>> >>> screenshot: >>> >>> >>> >>> http://s14.directupload.net/images/140108/8cmreir2.png >>> >>> >>> >>> What's the exact problem for this behavior and how can this be avoided? >>> >>> Thank you in advance! >>> >>> >>> >>> Cheers Martin >> >> Sure. Basically you want to use two parallel allpass chains where the >> phase difference between their outputs is 90 degrees over some >> frequency range. You start by choosing 1st-order or 2nd-order sections >> (if you need to get close to DC then 2nd-order might be better). The >> phase of each allpass will start from from 0 degrees and go to 360 >> degrees (for 2nd-order) so if you cascade them with frequencies offset >> by some factor, you get a net phase curve that decreases continuously >> with wiggles, over frequency. Generally, you want to construct the 2nd >> chain with the center freqs of the allpass filters in between the >> center freqs of the 1st chain. By plotting the unwrapped phase >> difference you can manually wiggle the center freqs and Q's to get the >> phase diff as close as possible to 90 degrees over the frequency range >> of interest. You won't be able to do a very good job manually, but you >> just want to get close enough the the optimizer won't fall into some >> local minimum trap. >> Then you write a function for the optimizer that returns an array of >> phase errors over the desired frequency range, and give it the freedom >> to adjust the allpass center freqs and Q's. Then hit return and go get >> a cup of coffee. When you come back you will hopefully find that the >> phase has equiripple errors around 90 degrees. It's not very hard to >> get phase error numbers that are very small (hundredths of a degree). >> It's also nice that you benefit from all the usual benefits of >> allpass-based filters (coefficient sensitivity, etc). > >PS: Bob, from your usenet client, did it appear that you were responding >to me? My client indicates your response to Martin's original post. I've >also noticed multiple times in the past that your responses don't line >up with the person you're responding to. >-- >Randy Yates >Digital Signal Labs >http://www.digitalsignallabs.com
For some reason Bob's posts almost always have the context deleted, so it does make it challenging to follow sometimes. Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On Wed, 8 Jan 2014 16:08:52 +0100, Martin Trummer
<m.trummer@nospam.org> wrote:

>Hi DSP-experts, > >I'm using a FIR hilbert-transformer (designed with Matlab's fdatool, >200 coefficients) for a envlope detection. For eg: > >% Signal is x, h contains coefficients of hilbert transforemer >x_analytical = filter(h,1,x); >x_delay = filter([zeros([1,99]), 1],1,x); >envelope = sqrt(x_analytical.^2+x_delay.^2); > >My problem is that the envelope doesn't fit very well since there is a >lot ringing on the envelope itself as you can see on the following >screenshot: > >http://s14.directupload.net/images/140108/8cmreir2.png > >What's the exact problem for this behavior and how can this be avoided? >Thank you in advance! > >Cheers Martin
Hello Matrin, Wow, this is a long thread. I haven't read all the posts but I'll just mention that some of the info at the following web page may be of some small value to you. http://www.dsprelated.com/showarticle/153.php Good Luck, [-Rick-]