Reply by Al Clark April 22, 20052005-04-22
"Mark" <makolber@yahoo.com> wrote in news:1113936336.390390.99070
@f14g2000cwb.googlegroups.com:

> thanks for all the replies > > there is also an interesting "trick" to eliminate the square root. > > In "Digital Signal Processing in Communication Systems" by Marvin E. > Frerking.. > > SQRT ( I^2 + Q^2) ~= ABS (L) + 0.4 ABS (S) > > where: > > ABS (L) = the absolute value of the larger of I or Q > > and > > ABS (S) = the absolute value of the smaller of I or Q > > > And to extend the discussion about ripple in the passband of the HT.. > to clarify this means ripple in the frequency response of the HT... > > what is the impact of passband frequency response ripple in the HT? > > It would seem if the 90 deg shifted version of the signal was not of > the correct amplitude i.e. it was not the same amplitude as the > original, when the I and Q signals are combined, there will be ripple > at 4x the carrier frequency in the recovered envelope. So the HT based > envelope detector _ideally_ can recover the envelope without any > carrier ripple but in practice due to frequency response ripple in the > HT, there will be some small 4x carrier frequency ripple in the > recovered envelope. > > It also seems that any phase error in the HT would have a similar > effect and cause 4x the carrier frequency ripple in the recovered > envelope. > > Is this essentially correct? > > thanks > Mark > >
If you are only looking at the passband section of the hilbert transform, the ripple can be made very small. The phase will be exact if the coefficients are antisymmetric. I see you quoted Frerking. This is maybe my favorite DSP book (I have about 50). Its hard to find. Rick's second edition does a great job on hilbert transforms. The ABS(L) + .4ABS(S) trick is commonly used where the accuracy is not real important. AGC detectors sometimes use this trick. You can find better approximations of this idea. If you want I really good square root, The SHARC has a reciprocal square root instruction. It takes a few iterations to get a result that is accurate to 1 LSB of a 32 or 40 bit float. -- Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
Reply by Jon Harris April 20, 20052005-04-20
"Jim Thomas" <jthomas@bittware.com> wrote in message
news:116d6am3o93oe89@corp.supernews.com...
> Rick Lyons wrote: > > On Wed, 20 Apr 2005 04:44:49 GMT, Al Clark <dsp@danvillesignal.com> > > wrote: > > > > (snipped) > > > >>If you are only looking at the passband section of the hilbert transform, > >>the ripple can be made very small. The phase will be exact if the > >>coefficients are antisymmetric. > >> > >>I see you quoted Frerking. This is maybe my favorite DSP book (I have > >>about 50). Its hard to find. Rick's second edition does a great job on > >>hilbert transforms. > >> > >>The ABS(L) + .4ABS(S) trick is commonly used where the accuracy is not > >>real important. AGC detectors sometimes use this trick. You can find > >>better approximations of this idea. > >> > >>If you want I really good square root, The SHARC has a reciprocal square > >>root instruction. It takes a few iterations to get a result that is > >>accurate to 1 LSB of a 32 or 40 bit float. > >> > > > > Hi Al, > > thanks for the kind words about my book. > > I appreciate them, a lot. > > > > That SHARC square root sounds interesting. > > I wonder if there's any way for us to learn > > about the algorithm (the algebra) that they > > use for their reciprocal sq root instruction. > > > > It's basically a lookup table to get the mantissa, and it's good for > 4-bits of accuracy. If all you need is 4-bits of accuracy, your answer > is one instruction cycle away. > > The Sharc also has an 8-bit accurate reciprocal instruction - also > implemented with a lookup table. > > Both of these instructions are intended to seed a polynomial.
Yep, it's nothing fancy. The full reciprocal and square root reciprocal algorithms use one of those iterative convergence algorithms (Newton-Raphson IIRC). If you give the algorithm a fairly accurate starting point, it can converge to your answer in a minimum of cycles. So the look-up table just provides that accurate starting point/seed. Note that there isn't a square root per se, but a reciprocal square root. But once you know 1/sqrt(x), finding sqrt(x) is as simple as multiplying by the x, i.e. sqrt(x) = 1/sqrt(x) * x. EXCEPT of course if x is zero, then it blows up, which is annoying and his bitten me a few times! So in practice, it's a good idea to do a check for zero before starting the algorithm. See http://www.analog.com/UploadedFiles/Associated_Docs/4096630649179865L_tr_comp_ref.pdf pages 42-45 for complete details.
Reply by Jim Thomas April 20, 20052005-04-20
Rick Lyons wrote:
> On Wed, 20 Apr 2005 04:44:49 GMT, Al Clark <dsp@danvillesignal.com> > wrote: > > (snipped) > >>If you are only looking at the passband section of the hilbert transform, >>the ripple can be made very small. The phase will be exact if the >>coefficients are antisymmetric. >> >>I see you quoted Frerking. This is maybe my favorite DSP book (I have >>about 50). Its hard to find. Rick's second edition does a great job on >>hilbert transforms. >> >>The ABS(L) + .4ABS(S) trick is commonly used where the accuracy is not >>real important. AGC detectors sometimes use this trick. You can find >>better approximations of this idea. >> >>If you want I really good square root, The SHARC has a reciprocal square >>root instruction. It takes a few iterations to get a result that is >>accurate to 1 LSB of a 32 or 40 bit float. >> >>-- >>Al Clark > > > Hi Al, > thanks for the kind words about my book. > I appreciate them, a lot. > > That SHARC square root sounds interesting. > I wonder if there's any way for us to learn > about the algorithm (the algebra) that they > use for their reciprocal sq root instruction. >
It's basically a lookup table to get the mantissa, and it's good for 4-bits of accuracy. If all you need is 4-bits of accuracy, your answer is one instruction cycle away. The Sharc also has an 8-bit accurate reciprocal instruction - also implemented with a lookup table. Both of these instructions are intended to seed a polynomial. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 Sometimes experience is the only teacher that works - Mike Rosing
Reply by Rick Lyons April 20, 20052005-04-20
On Wed, 20 Apr 2005 04:44:49 GMT, Al Clark <dsp@danvillesignal.com>
wrote:

  (snipped)
>> > >If you are only looking at the passband section of the hilbert transform, >the ripple can be made very small. The phase will be exact if the >coefficients are antisymmetric. > >I see you quoted Frerking. This is maybe my favorite DSP book (I have >about 50). Its hard to find. Rick's second edition does a great job on >hilbert transforms. > >The ABS(L) + .4ABS(S) trick is commonly used where the accuracy is not >real important. AGC detectors sometimes use this trick. You can find >better approximations of this idea. > >If you want I really good square root, The SHARC has a reciprocal square >root instruction. It takes a few iterations to get a result that is >accurate to 1 LSB of a 32 or 40 bit float. > >-- >Al Clark
Hi Al, thanks for the kind words about my book. I appreciate them, a lot. That SHARC square root sounds interesting. I wonder if there's any way for us to learn about the algorithm (the algebra) that they use for their reciprocal sq root instruction. See ya', [-Rick-]
Reply by Rick Lyons April 20, 20052005-04-20
On 19 Apr 2005 11:45:36 -0700, "Mark" <makolber@yahoo.com> wrote:

>thanks for all the replies > >there is also an interesting "trick" to eliminate the square root. > >In "Digital Signal Processing in Communication Systems" by Marvin E. >Frerking.. > >SQRT ( I^2 + Q^2) ~= ABS (L) + 0.4 ABS (S) > >where: > > ABS (L) = the absolute value of the larger of I or Q > >and > >ABS (S) = the absolute value of the smaller of I or Q
Hi Mark, I haven't seen the SQRT(I^2 + Q^2) ~= ABS(L) + 0.4*ABS(S) algorithm before (I don't think), but the SQRT(I^2 + Q^2) ~= ABS(L) + 0.5*ABS(S) method has been around for a long time. In my book I discuss the SQRT(I^2 + Q^2) ~= A*ABS(L) + B*ABS(S) algorithm for a half dozen different combinations of "A" and "B". Good Luck & see ya', [-Rick-]
Reply by Rick Lyons April 20, 20052005-04-20
On Tue, 19 Apr 2005 15:38:49 +1000, Andrew Reilly
<andrew-newspost@areilly.bpc-users.org> wrote:

  (snipped)
>> >> 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
Hi Andrew, Yep. I have a copy of your nice paper. It's one of those exceedingly rare IEEE papers that are actually useful to "down in the trenches" working DSP engineers. See Ya', [-Rick-]
Reply by Al Clark April 20, 20052005-04-20
"Mark" <makolber@yahoo.com> wrote in news:1113936336.390390.99070
@f14g2000cwb.googlegroups.com:

> thanks for all the replies > > there is also an interesting "trick" to eliminate the square root. > > In "Digital Signal Processing in Communication Systems" by Marvin E. > Frerking.. > > SQRT ( I^2 + Q^2) ~= ABS (L) + 0.4 ABS (S) > > where: > > ABS (L) = the absolute value of the larger of I or Q > > and > > ABS (S) = the absolute value of the smaller of I or Q > > > And to extend the discussion about ripple in the passband of the HT.. > to clarify this means ripple in the frequency response of the HT... > > what is the impact of passband frequency response ripple in the HT? > > It would seem if the 90 deg shifted version of the signal was not of > the correct amplitude i.e. it was not the same amplitude as the > original, when the I and Q signals are combined, there will be ripple > at 4x the carrier frequency in the recovered envelope. So the HT based > envelope detector _ideally_ can recover the envelope without any > carrier ripple but in practice due to frequency response ripple in the > HT, there will be some small 4x carrier frequency ripple in the > recovered envelope. > > It also seems that any phase error in the HT would have a similar > effect and cause 4x the carrier frequency ripple in the recovered > envelope. > > Is this essentially correct? > > thanks > Mark > >
If you are only looking at the passband section of the hilbert transform, the ripple can be made very small. The phase will be exact if the coefficients are antisymmetric. I see you quoted Frerking. This is maybe my favorite DSP book (I have about 50). Its hard to find. Rick's second edition does a great job on hilbert transforms. The ABS(L) + .4ABS(S) trick is commonly used where the accuracy is not real important. AGC detectors sometimes use this trick. You can find better approximations of this idea. If you want I really good square root, The SHARC has a reciprocal square root instruction. It takes a few iterations to get a result that is accurate to 1 LSB of a 32 or 40 bit float. -- Al Clark Danville Signal Processing, Inc. -------------------------------------------------------------------- Purveyors of Fine DSP Hardware and other Cool Stuff Available at http://www.danvillesignal.com
Reply by Mark April 19, 20052005-04-19
thanks for all the replies

there is also an interesting "trick" to eliminate the square root.

In "Digital Signal Processing in Communication Systems" by Marvin E.
Frerking..

SQRT ( I^2 + Q^2)   ~=  ABS (L) + 0.4 ABS (S)

where:

 ABS (L) = the absolute value of the larger of I or Q

and

ABS (S) = the absolute value of the smaller of I or Q


And to extend the discussion about ripple in the passband of the  HT..
to clarify this means ripple in the frequency response of the HT...

what is the impact of passband frequency response ripple in the HT?

It would seem if the 90 deg shifted version of the signal was not of
the correct amplitude i.e. it was not the same amplitude as the
original,  when the I and Q signals are combined, there will be ripple
at 4x the carrier frequency in the recovered envelope.  So the HT based
envelope detector  _ideally_   can recover the envelope without any
carrier ripple but in practice due to frequency response ripple in the
HT, there will be some small 4x carrier frequency ripple in the
recovered envelope.

It also seems that any phase error in the HT would have a similar
effect and cause  4x the carrier frequency ripple in the recovered
envelope.

Is this essentially correct?

thanks
Mark

Reply by Al Clark April 19, 20052005-04-19
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
Reply by Andrew Reilly April 19, 20052005-04-19
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