Sign in

Not a member? | Forgot your Password?

Search compdsp

Search tips

Find us on Facebook!





Free PDF Downloads

A Quadrature Signals Tutorial: Complex, But Not Complicated

Understanding the 'Phasing Method' of Single Sideband Demodulation

Complex Digital Signal Processing in Telecommunications

Introduction to Sound Processing

C++ Tutorial

Introduction of C Programming for DSP Applications

Fixed-Point Arithmetic: An Introduction

Cascaded Integrator-Comb (CIC) Filter Introduction

Discussion Groups

FIR Filter Design Software

Free Online Books

See Also

Embedded SystemsFPGA

Discussion Groups | Comp.DSP | Implementation of Arctan(x)

There are 20 messages in this thread.

You are currently looking at messages 1 to .


Is this discussion worth a thumbs up?

0

Implementation of Arctan(x) - karthikw - 2007-10-01 12:16:00

Hi,
     I am  implementing arctan(x) in hardware can any one suggest me any
of the algorithms other than cordic because it takes lots of iterations to
reach the final result. 

Thanks and Regards 
Karthik W


Re: Implementation of Arctan(x) - Tim Wescott - 2007-10-01 12:24:00

karthikw wrote:
> Hi,
>      I am  implementing arctan(x) in hardware can any one suggest me any
> of the algorithms other than cordic because it takes lots of iterations to
> reach the final result. 
> 
Some sort of a table lookup + interpolation will probably be the best as 
far as speed/size.  No matter what you do, you'll have some interesting 
effects as the slope goes to infinity -- you'll either be taking 
reciprocals (not speedy), or _really_ juggling cost/speed/precision issues.

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html


Re: Implementation of Arctan(x) - Randy Yates - 2007-10-01 13:21:00

"karthikw" <k...@gmail.com> writes:

> Hi,
>      I am  implementing arctan(x) in hardware can any one suggest me any
> of the algorithms other than cordic because it takes lots of iterations to
> reach the final result. 
>
> Thanks and Regards 
> Karthik W

Hi Karthik,

Try:

Efficient approximations for the arctangent function
Rajan, S.; Sichun Wang; Inkol, R.; Joyal, A.;
Signal Processing Magazine, IEEE
Volume 23,  Issue 3,  May 2006 Page(s):108 - 111
Digital Object Identifier 10.1109/MSP.2006.1628884
Summary: This paper provides several efficient approximations for the arctangent function using Lagrange interpolation and minimax optimization techniques. These approximations are particularly useful when processing power, memory, and power consumption are i.....
-- 
%  Randy Yates                  % "With time with what you've learned, 
%% Fuquay-Varina, NC            %  they'll kiss the ground you walk 
%%% 919-577-9882                %  upon."
%%%% <y...@ieee.org>           % '21st Century Man', *Time*, ELO
http://www.digitalsignallabs.com


Re: Implementation of Arctan(x) - Jerry Avins - 2007-10-01 13:37:00

karthikw wrote:
> Hi,
>      I am  implementing arctan(x) in hardware can any one suggest me any
> of the algorithms other than cordic because it takes lots of iterations to
> reach the final result. 

What accuracy do you need? Over what range?

Jerry
-- 
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


Re: Implementation of Arctan(x) - HardySpicer - 2007-10-01 15:51:00

On Oct 2, 5:16 am, "karthikw" <karthikw...@gmail.com> wrote:
> Hi,
>      I am  implementing arctan(x) in hardware can any one suggest me any
> of the algorithms other than cordic because it takes lots of iterations to
> reach the final result.
>
> Thanks and Regards
> Karthik W

If you are demodulating FM then forget it. You don't need arctan(x).

Hardy


Re: Implementation of Arctan(x) - Andor - 2007-10-01 16:33:00

Tim Wescott wrote:
> karthikw wrote:
> > Hi,
> >      I am  implementing arctan(x) in hardware can any one suggest me any
> > of the algorithms other than cordic because it takes lots of iterations to
> > reach the final result.
>
> Some sort of a table lookup + interpolation will probably be the best as
> far as speed/size.  No matter what you do, you'll have some interesting
> effects as the slope goes to infinity

The slope of the arctan goes to zero, not infinity. Perhaps this is
interesting:

http://dspguru.com/comp.dsp/tricks/alg/fxdatan2.htm

Regards,
Andor


Re: Implementation of Arctan(x) - Tim Wescott - 2007-10-01 16:40:00

Andor wrote:
> Tim Wescott wrote:
>> karthikw wrote:
>>> Hi,
>>>      I am  implementing arctan(x) in hardware can any one suggest me any
>>> of the algorithms other than cordic because it takes lots of iterations to
>>> reach the final result.
>> Some sort of a table lookup + interpolation will probably be the best as
>> far as speed/size.  No matter what you do, you'll have some interesting
>> effects as the slope goes to infinity
> 
> The slope of the arctan goes to zero, not infinity. Perhaps this is
> interesting:
> 
arctan(x) = sin(x)/cos(x).  As x goes to pi/2 the arctan (and it's 
slope) goes to infinity.

Granted, for pi/4 < x < pi/2 you can use 1/(arctan(pi/2-x)) -- but then 
you're calculating a reciprocal, of a number, so you're back to some 
computationally intensive calculation.

Not that I'm an expert.  I've always sliced and diced the ordinate down 
to 0 <= x <= pi/4, then negated and inverted as necessary -- but I've 
never needed the absolute fastest speed, either.

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html


Re: Implementation of Arctan(x) - Andor - 2007-10-01 16:41:00

Tim Wescott <t...@seemywebsite.com> wrote:
> Andor wrote:
> > Tim Wescott wrote:
> >> karthikw wrote:
> >>> Hi,
> >>>      I am  implementing arctan(x) in hardware can any one suggest me any
> >>> of the algorithms other than cordic because it takes lots of iterations to
> >>> reach the final result.
> >> Some sort of a table lookup + interpolation will probably be the best as
> >> far as speed/size.  No matter what you do, you'll have some interesting
> >> effects as the slope goes to infinity
>
> > The slope of the arctan goes to zero, not infinity. Perhaps this is
> > interesting:
>
> arctan(x) = sin(x)/cos(x).  As x goes to pi/2 the arctan (and it's
> slope) goes to infinity.

You are mixing up tan with arctan.

Regards,
andor


Re: Implementation of Arctan(x) - Tim Wescott - 2007-10-01 17:43:00

Andor wrote:
> Tim Wescott <t...@seemywebsite.com> wrote:
>> Andor wrote:
>>> Tim Wescott wrote:
>>>> karthikw wrote:
>>>>> Hi,
>>>>>      I am  implementing arctan(x) in hardware can any one suggest me any
>>>>> of the algorithms other than cordic because it takes lots of iterations to
>>>>> reach the final result.
>>>> Some sort of a table lookup + interpolation will probably be the best as
>>>> far as speed/size.  No matter what you do, you'll have some interesting
>>>> effects as the slope goes to infinity
>>> The slope of the arctan goes to zero, not infinity. Perhaps this is
>>> interesting:
>> arctan(x) = sin(x)/cos(x).  As x goes to pi/2 the arctan (and it's
>> slope) goes to infinity.
> 
> You are mixing up tan with arctan.
> 
> Regards,
> andor
> 
Argh.  So I am.

In which case a look-up table would work nice, except for the minor 
problem of the infinite ordinate -- then one may want a lookup table 
with ever-increasing intervals, which actually wouldn't be too bad to 
implement.

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html


Re: Implementation of Arctan(x) - robert bristow-johnson - 2007-10-01 18:03:00

On Oct 1, 5:43 pm, Tim Wescott <t...@seemywebsite.com> wrote:
>
...
>
> In which case a look-up table would work nice, except for the minor
> problem of the infinite ordinate -- then one may want a lookup table
> with ever-increasing intervals, which actually wouldn't be too bad to
> implement.

so how would one determine the index into the table without some
repeated search and compare operations?

also, i think something like

    arctan(1/x) = pi/2 - arctan(x)

can be used for the the nearly infinite ordinates, no?  (a division is
required.)

dunno how this would work for hardware, but if a single division is
tolerable and
for -1 <= x <= 1, a very accurate approximation is:

    arctan(x) ~= x/f(x^2)

where

    f(u)  =     1.0
             +  0.33288950512027 * u
             + -0.08467922817644 * u^2
             +  0.03252232640125 * u^3
             + -0.00749305860992 * u^4

maybe too many terms, but it's not the finite power series that's bad,
but the division by it that's costly in many different contexts.

r b-j


| 1 | |