Reply by Rick Lyons January 15, 20142014-01-15
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-]
Reply by Eric Jacobsen January 13, 20142014-01-13
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
Reply by robert bristow-johnson January 13, 20142014-01-13
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."
Reply by January 13, 20142014-01-13
Sorry, I usually respond on my iphone via google groups, can anyone suggest a way to improve this?

Bob
Reply by robert bristow-johnson January 13, 20142014-01-13
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."
Reply by Randy Yates January 12, 20142014-01-12
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
Reply by Randy Yates January 12, 20142014-01-12
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).
Bob, thanks for this. I'm not sure I follow it completely, but I think there's enough here to guide me if I decide to try it. Thanks for adding another item to my Hibert transform bag-of-tricks! -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Reply by January 10, 20142014-01-10
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).
Reply by Randy Yates January 9, 20142014-01-09
radams2000@gmail.com writes:

> Randy > > Yes sounds like that should work. If the desired frequency band was > near DC, and you want unity magnitude in both paths, would that result > in a very long filter?
Bob, see my response to Clay. The optimization of the filter length I thought you would get with a smaller passband bandwidth won't happen. :( Perhaps I'm a little thick, but can you please explain the technique I start out by manually tuning a parallel set of allpass filters using staggered frequencies and then use Matlab lsqnonlin which is in the optimization toolbox. a little more? -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Reply by Randy Yates January 9, 20142014-01-09
clay@claysturner.com writes:

> 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, &ldquo;Analytic > signal generation&mdash;Tips and traps,&rdquo; IEEE Trans. > Signal Processing, vol. 42, no. 11, Nov. 1994, pp. > 3241&ndash;3245.
Thanks for the reference, Clay. I see from that paper (namely, the way the stop-band edges line up in figure 2) that you really can't increase the transition band like I thought when reducing the passband bandwidth (otherwise you'd get some negative frequency leakage). Bummer. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com