Magnitude by summing |I| & |Q|

This is a discussion on Magnitude by summing |I| & |Q| within the DSP forums in Other Technologies category; Hello, I'm trying to write a very efficient and fast detection algorithm for a dsPIC. I've already been down the path of the Goertzel and have dismissed it because of it's use of floating point numbers. I am now using a modified DFT and would like to get rid of the square root algorithm that calculates the magnitude of I & Q. It seems to me that simply summing (the accumulated) I & Q channels it will give you a cheap and dirty indication of gain. Summing their absolute values, that is. Does anyone see anything wrong with this? Are ...

Go Back   Application Development Forum > Other Technologies > DSP

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-03-2008, 02:50 PM
Thomas Magma
Guest
 
Default Magnitude by summing |I| & |Q|

Hello,

I'm trying to write a very efficient and fast detection algorithm for a
dsPIC. I've already been down the path of the Goertzel and have dismissed it
because of it's use of floating point numbers. I am now using a modified DFT
and would like to get rid of the square root algorithm that calculates the
magnitude of I & Q. It seems to me that simply summing (the accumulated) I
& Q channels it will give you a cheap and dirty indication of gain. Summing
their absolute values, that is. Does anyone see anything wrong with this?
Are there any draw backs of doing this?

Thomas


Reply With Quote
  #2  
Old 09-03-2008, 02:56 PM
julius
Guest
 
Default Re: Magnitude by summing |I| & |Q|

On Sep 3, 1:50*pm, "Thomas Magma" <somewh...@overtherainbow.com>
wrote:
> Hello,
>
> I'm trying to write a very efficient and fast detection algorithm for a
> dsPIC. I've already been down the path of the Goertzel and have dismissedit
> because of it's use of floating point numbers. I am now using a modified DFT
> and would like to get rid of the square root algorithm that calculates the
> magnitude of *I & Q. It seems to me that simply summing (the accumulated) I
> & Q channels it will give you a cheap and dirty indication of gain. Summing
> their absolute values, that is. Does anyone see anything wrong with this?
> Are there any draw backs of doing this?
>
> Thomas


Make a surface plot (output on Z, and actual values of I and Q on the
X and Y
axes) and compare the two approaches. Where are they most similar?
Where are they most dissimilar?

Julius
Reply With Quote
  #3  
Old 09-03-2008, 03:03 PM
dbell
Guest
 
Default Re: Magnitude by summing |I| & |Q|

On Sep 3, 2:50*pm, "Thomas Magma" <somewh...@overtherainbow.com>
wrote:
> Hello,
>
> I'm trying to write a very efficient and fast detection algorithm for a
> dsPIC. I've already been down the path of the Goertzel and have dismissedit
> because of it's use of floating point numbers. I am now using a modified DFT
> and would like to get rid of the square root algorithm that calculates the
> magnitude of *I & Q. It seems to me that simply summing (the accumulated) I
> & Q channels it will give you a cheap and dirty indication of gain. Summing
> their absolute values, that is. Does anyone see anything wrong with this?
> Are there any draw backs of doing this?
>
> Thomas


Thomas,

Search this topic in this group. It's been discusssed.

Dirk
Reply With Quote
  #4  
Old 09-03-2008, 04:18 PM
Vladimir Vassilevsky
Guest
 
Default Re: Magnitude by summing |I| & |Q|



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%

BTW, in R. Lyons book, there is a chapter about sqrt(I^2 + Q^2)
approximation.

> It seems to me that simply summing (the accumulated) I
> & Q channels it will give you a cheap and dirty indication of gain. Summing
> their absolute values, that is. Does anyone see anything wrong with this?


Max. error ~ 40%


Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com
Reply With Quote
  #5  
Old 09-03-2008, 05:42 PM
Thomas Magma
Guest
 
Default Re: Magnitude by summing |I| & |Q|

>
> There is no point. With dsPIC, Goertzel is more efficient then I/Q
> accumulation.
>


Actually, the Goertzel is terribly inefficient with the dsPIC, at least when
using floating point and the C30 compiler. Floating point addition,
subtraction and multiplication take hundreds of cycles to complete on the
dsPIC. I couldn't find any good examples of the Goertzel done with integers.

Using the floating point Goertzel I was something like 1000 times the
required processing time, now with an integer DFT using a look-up sin/cos
table I am less than 10 percent over the required processing time. I am
very close to my target, hence my original question.

>Max. error ~ 40%


Where do you get 40% from. All I'm doing is tone detection where the gain
triggers a preset value. Are you saying that there is 40% noise on the
magnitude output? This might be acceptable depending where my noise floor is
and where I set my trigger value.

Thomas


Reply With Quote
  #6  
Old 09-03-2008, 06:05 PM
Vladimir Vassilevsky
Guest
 
Default Re: Magnitude by summing |I| & |Q|



Thomas Magma wrote:

>>There is no point. With dsPIC, Goertzel is more efficient then I/Q
>>accumulation.
>>

>
> Actually, the Goertzel is terribly inefficient with the dsPIC, at least when
> using floating point and the C30 compiler.


There is no need for the floating point to do Goertzel.

> Floating point addition,
> subtraction and multiplication take hundreds of cycles to complete on the
> dsPIC. I couldn't find any good examples of the Goertzel done with integers.


Example of Goertzel, eh? As you already noticed, the things are not
going to work that way. You have to start learning from the very basics.

> Using the floating point Goertzel I was something like 1000 times the
> required processing time, now with an integer DFT using a look-up sin/cos
> table I am less than 10 percent over the required processing time. I am
> very close to my target, hence my original question.


How did you manage to get such a poor result?

>
>>Max. error ~ 40%

>
>
> Where do you get 40% from.


Elementary school.

> All I'm doing is tone detection where the gain
> triggers a preset value. Are you saying that there is 40% noise on the
> magnitude output?


No. What I said is the amplitude can be 40% different from the true value.

> This might be acceptable depending where my noise floor is
> and where I set my trigger value.
>
> Thomas
>


VLV

Reply With Quote
  #7  
Old 09-03-2008, 06:29 PM
Thomas Magma
Guest
 
Default Re: Magnitude by summing |I| & |Q|


> Floating point addition,
>> subtraction and multiplication take hundreds of cycles to complete on the
>> dsPIC. I couldn't find any good examples of the Goertzel done with
>> integers.

>
> Example of Goertzel, eh? As you already noticed, the things are not going
> to work that way. You have to start learning from the very basics.
>


How many people do you know that have re-written the Goertzel for integers,
or people that even really understand the algorithm? I pitty the person that
has to pay for you to re-invent the wheel.

>> Using the floating point Goertzel I was something like 1000 times the
>> required processing time, now with an integer DFT using a look-up sin/cos
>> table I am less than 10 percent over the required processing time. I am
>> very close to my target, hence my original question.

>
> How did you manage to get such a poor result?
>


Sorry that should be 1000 percent not 1000 times.

>>
>>>Max. error ~ 40%

>>
>>
>> Where do you get 40% from.

>
> Elementary school.
>


OK point well taken, I did the math. But if everyone went ahead and figured
out the answers on their own, there would be no more newsgroups and you
would have too much time on your hands.

Thomas


Reply With Quote
  #8  
Old 09-03-2008, 06:33 PM
dbell
Guest
 
Default Re: Magnitude by summing |I| & |Q|


>
> OK point well taken, I did the math. But if everyone went ahead and figured
> out the answers on their own, there would be no more newsgroups and you
> would have too much time on your hands.
>
> Thomas



And that would be bad because .......?

Dirk
Reply With Quote
  #9  
Old 09-03-2008, 06:44 PM
langwadt@fonz.dk
Guest
 
Default Re: Magnitude by summing |I| & |Q|

On 3 Sep., 20:50, "Thomas Magma" <somewh...@overtherainbow.com> wrote:
> Hello,
>
> I'm trying to write a very efficient and fast detection algorithm for a
> dsPIC. I've already been down the path of the Goertzel and have dismissed it
> because of it's use of floating point numbers. I am now using a modified DFT
> and would like to get rid of the square root algorithm that calculates the
> magnitude of I & Q. It seems to me that simply summing (the accumulated) I
> & Q channels it will give you a cheap and dirty indication of gain. Summing
> their absolute values, that is. Does anyone see anything wrong with this?
> Are there any draw backs of doing this?
>
> Thomas


read these:?

http://www.analog.com/static/importe...sp2100vol1.zip
(chapter14)
http://www.analog.com/static/importe...sp2100vol2.zip
(chapter8)

-Lasse
Reply With Quote
  #10  
Old 09-03-2008, 10:37 PM
Jerry Avins
Guest
 
Default Re: Magnitude by summing |I| & |Q|

Thomas Magma wrote:
> Hello,
>
> I'm trying to write a very efficient and fast detection algorithm for a
> dsPIC. 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 fixed point. Over four years ago, someone at Rice U
published code to handle DTMF on an 8-bit integer microprocessor. Maybe
you can find it.

Jerry
--
Engineering is the art of making what you want from things you can get.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 07:12 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.