On 4 Sep., 06:37, Eric Jacobsen <eric.jacob...@ieee.org> wrote:> On Wed, 03 Sep 2008 22:48:07 -0400, Jerry Avins <j...@ieee.org> wrote: > >langw...@fonz.dk wrote: > > > ... > > >> -Lasse > > >You've been gone a long time. Nice to hear from you! > > >Jerry > > I was thinking the same. Hiya, Lasse! >Hi guys, dont worry I hang out in the neighborhood :) -Lasse

# Magnitude by summing |I| & |Q|

Started by ●September 3, 2008

Reply by ●September 5, 20082008-09-05

Reply by ●September 11, 20082008-09-11

On Sep 4, 3:28�pm, c...@claysturner.com wrote:> > > And actually a filter method involving a DSP was made compliant to > > > Bell specs. Bell Labs did an implementation modelled around a standard > > > central office line receiver during the early '80s. I have a copy of > > > their writeup from the Bell System Journel which describes in great > > > detail their actual application. > > > Can you please explain briefly what they did. > > > Vladimir Vassilevsky > > DSP and Mixed Signal Design Consultanthttp://www.abvolt.com > > Hello Vladimir, > > Recalling from memory as the article is at home (I haven't looked at > it for years), they really modelled the actual analog unit. First the > signal would have both a mains and dial tone notch filter to clean it > up. Then the signal was split into two branches where one goes through > a high band group and the other branch goes through a low band group. > The band filters would span either 4 row freqs or 4 column freqs > depending on which group we are talking about. Then the output of each > group filter would be split and go into four row(column) narrow band > pass filters ( I seem to recall they were 4th order each - lower Q - > faster transient response). > > Then each filter's ouput would be rectified and passed into a fast > attack slow release circuit akin to a simple AGC. These filtered > results would then go to some comparators for thresholding and then > the band results were compared for twist analysis. > > If I think about it when I get back to the farm, I'll find the paper > and give you more details. > > ClayHello Vladimir et al, The paper is "Receiver for TOUCH-TONE Service" by J. R. Boddie, N. Sachs, and J. Tow., The Bell System System Technical Journal, Vol. 60, No. 7, September 1981. The modelled a central office grade receiver - an "H" type. And then they put the design into a single chip. Tests on the design confirmed its equivalency to the actual office receiver. Even though the publishing date is Sept. 1981, the manuscript was received on July 2, 1980! Clay

Reply by ●September 11, 20082008-09-11

On Sep 3, 4:18�pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> wrote:> Thomas Magma wrote: > > Hello, > > > I'm trying to write a very efficient and fast detection algorithm for a > > dsPIC. > > To detect what? > > > I've already been down the path of the Goertzel and have dismissed it > > because of it's use of floating point numbers. > > Goertzel can be done in the integer math. > > > I am now using a modified DFT > > There is no point. With dsPIC, Goertzel is more efficient then I/Q > accumulation. > > > and would like to get rid of the square root algorithm that calculates the > > magnitude of �I & Q. > > sqrt(I^2 + Q^2) ~ max(|I|,|Q|) + (min(|I|,|Q|) >> 2) > The error is less then 10% >I think you mean either >>1 or /2, no?

Reply by ●September 11, 20082008-09-11

John wrote:> On Sep 3, 4:18 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> > wrote: >> Thomas Magma wrote: >>> Hello, >>> I'm trying to write a very efficient and fast detection algorithm for a >>> dsPIC. >> To detect what? >> >>> I've already been down the path of the Goertzel and have dismissed it >>> because of it's use of floating point numbers. >> Goertzel can be done in the integer math. >> >>> I am now using a modified DFT >> There is no point. With dsPIC, Goertzel is more efficient then I/Q >> accumulation. >> >>> and would like to get rid of the square root algorithm that calculates the >>> magnitude of I & Q. >> sqrt(I^2 + Q^2) ~ max(|I|,|Q|) + (min(|I|,|Q|) >> 2) >> The error is less then 10% >> > > I think you mean either >>1 or /2, no?Either way. 3/8 is a bit better. See http://www.dspguru.com/comp.dsp/tricks/alg/mag_est.htm Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●September 12, 20082008-09-12

On Sep 12, 4:59�am, Jerry Avins <j...@ieee.org> wrote:> John wrote: > > On Sep 3, 4:18 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> > > wrote: > >> Thomas Magma wrote: > >>> Hello, > >>> I'm trying to write a very efficient and fast detection algorithm for a > >>> dsPIC. > >> To detect what? > > >>> I've already been down the path of the Goertzel and have dismissed it > >>> because of it's use of floating point numbers. > >> Goertzel can be done in the integer math. > > >>> I am now using a modified DFT > >> There is no point. With dsPIC, Goertzel is more efficient then I/Q > >> accumulation. > > >>> and would like to get rid of the square root algorithm that calculates the > >>> magnitude of �I & Q. > >> sqrt(I^2 + Q^2) ~ max(|I|,|Q|) + (min(|I|,|Q|) >> 2) > >> The error is less then 10% > > > I think you mean either >>1 or /2, no? > > Either way. 3/8 is a bit better. Seehttp://www.dspguru.com/comp.dsp/tricks/alg/mag_est.htmThat's considerably better than 1/2 or 1/4, but requires an extra add. I remember when that involved numerous extra chips, and we deeply debated whether we could live with the reduced precision. One guy treated "greater plus three eighths of the lesser" as a mantra. Times change. :-) For most purposes using 1/2 or 1/4 gives comparable results. The errors nudge in different directions, so one or other sometimes works out better in specific applications. Regards, Steve

Reply by ●September 12, 20082008-09-12

On Sep 12, 2:42�am, ste...@coppice.org wrote:> On Sep 12, 4:59�am, Jerry Avins <j...@ieee.org> wrote: > > > > > John wrote: > > > On Sep 3, 4:18 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> > > > wrote: > > >> Thomas Magma wrote: > > >>> Hello, > > >>> I'm trying to write a very efficient and fast detection algorithm for a > > >>> dsPIC. > > >> To detect what? > > > >>> I've already been down the path of the Goertzel and have dismissed it > > >>> because of it's use of floating point numbers. > > >> Goertzel can be done in the integer math. > > > >>> I am now using a modified DFT > > >> There is no point. With dsPIC, Goertzel is more efficient then I/Q > > >> accumulation. > > > >>> and would like to get rid of the square root algorithm that calculates the > > >>> magnitude of �I & Q. > > >> sqrt(I^2 + Q^2) ~ max(|I|,|Q|) + (min(|I|,|Q|) >> 2) > > >> The error is less then 10% > > > > I think you mean either >>1 or /2, no? > > > Either way. 3/8 is a bit better. Seehttp://www.dspguru.com/comp.dsp/tricks/alg/mag_est.htm > > That's considerably better than 1/2 or 1/4, but requires an extra add. > I remember when that involved numerous extra chips, and we deeply > debated whether we could live with the reduced precision. One guy > treated "greater plus three eighths of the lesser" as a mantra. Times > change. :-) > > For most purposes using 1/2 or 1/4 gives comparable results. The > errors nudge in different directions, so one or other sometimes works > out better in specific applications. > > Regards, > SteveSuppose I want the time-average magnitude of a vector. Is it better to average |I| and |Q| and then apply the approximation, or average the approximation? Thanks, John

Reply by ●September 12, 20082008-09-12

steveu@coppice.org wrote:> On Sep 12, 4:59 am, Jerry Avins <j...@ieee.org> wrote: >> John wrote: >>> On Sep 3, 4:18 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> >>> wrote: >>>> Thomas Magma wrote: >>>>> Hello, >>>>> I'm trying to write a very efficient and fast detection algorithm for a >>>>> dsPIC. >>>> To detect what? >>>>> I've already been down the path of the Goertzel and have dismissed it >>>>> because of it's use of floating point numbers. >>>> Goertzel can be done in the integer math. >>>>> I am now using a modified DFT >>>> There is no point. With dsPIC, Goertzel is more efficient then I/Q >>>> accumulation. >>>>> and would like to get rid of the square root algorithm that calculates the >>>>> magnitude of I & Q. >>>> sqrt(I^2 + Q^2) ~ max(|I|,|Q|) + (min(|I|,|Q|) >> 2) >>>> The error is less then 10% >>> I think you mean either >>1 or /2, no? >> Either way. 3/8 is a bit better. Seehttp://www.dspguru.com/comp.dsp/tricks/alg/mag_est.htm > > That's considerably better than 1/2 or 1/4, but requires an extra add. > I remember when that involved numerous extra chips, and we deeply > debated whether we could live with the reduced precision. One guy > treated "greater plus three eighths of the lesser" as a mantra. Times > change. :-) > > For most purposes using 1/2 or 1/4 gives comparable results. The > errors nudge in different directions, so one or other sometimes works > out better in specific applications.The page I cited was written by Grant Griffin who did a thorough analysis of various proposed approximations, including the traditional ones. Clay Turner had his oar in. MAX*61/64 + MIN*3/8 has an average error just over 2%. For machines that can multiply by arbitrary constants, .947543636291*MAX + .392485425092*MIN, with an average error of only .055%, is better yet. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●September 12, 20082008-09-12

John wrote:> On Sep 12, 2:42 am, ste...@coppice.org wrote: >> On Sep 12, 4:59 am, Jerry Avins <j...@ieee.org> wrote: >> >> >> >>> John wrote: >>>> On Sep 3, 4:18 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com> >>>> wrote: >>>>> Thomas Magma wrote: >>>>>> Hello, >>>>>> I'm trying to write a very efficient and fast detection algorithm for a >>>>>> dsPIC. >>>>> To detect what? >>>>>> I've already been down the path of the Goertzel and have dismissed it >>>>>> because of it's use of floating point numbers. >>>>> Goertzel can be done in the integer math. >>>>>> I am now using a modified DFT >>>>> There is no point. With dsPIC, Goertzel is more efficient then I/Q >>>>> accumulation. >>>>>> and would like to get rid of the square root algorithm that calculates the >>>>>> magnitude of I & Q. >>>>> sqrt(I^2 + Q^2) ~ max(|I|,|Q|) + (min(|I|,|Q|) >> 2) >>>>> The error is less then 10% >>>> I think you mean either >>1 or /2, no? >>> Either way. 3/8 is a bit better. Seehttp://www.dspguru.com/comp.dsp/tricks/alg/mag_est.htm >> That's considerably better than 1/2 or 1/4, but requires an extra add. >> I remember when that involved numerous extra chips, and we deeply >> debated whether we could live with the reduced precision. One guy >> treated "greater plus three eighths of the lesser" as a mantra. Times >> change. :-) >> >> For most purposes using 1/2 or 1/4 gives comparable results. The >> errors nudge in different directions, so one or other sometimes works >> out better in specific applications. >> >> Regards, >> Steve > > Suppose I want the time-average magnitude of a vector. Is it better to > average |I| and |Q| and then apply the approximation, or average the > approximation?Whether the magnitudes are calculated exactly or approximated, average the magnitudes. Average magnitude and the magnitude of average I and Q can be very different. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������