Arctan or Arccos?
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
Arctan or Arccos?

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> DSP
Author Message
Real_McCoy
Guest





Posted: Sat Dec 03, 2005 1:16 am    Post subject: Arctan or Arccos? Reply with quote

I remember a mathematician saying to me a while back that engineers always
work out phase using arctan (img/real).

He went on to say that this was not a good method due to problems with
quadrants etc. Far better to use arccos
arccos(real/abs) if my sums are right.

McC
Back to top
Tim Wescott
Guest





Posted: Sat Dec 03, 2005 1:16 am    Post subject: Re: Arctan or Arccos? Reply with quote

Real_McCoy wrote:
Quote:
I remember a mathematician saying to me a while back that engineers always
work out phase using arctan (img/real).

He went on to say that this was not a good method due to problems with
quadrants etc. Far better to use arccos
arccos(real/abs) if my sums are right.

McC


Either one leads to ambiguities.


If you're going to obtain an angle directly using trig functions you
want to use something like atan2 in the C library, which takes two
arguments.

In the guts of the thing it finds the quadrant based on the relative
absolute values and the signs of the numbers, then it takes theta =
arctan(x) where |x| is always less than 1, then it flips and offsets
theta to put it in the correct quadrant.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Back to top
robert bristow-johnson
Guest





Posted: Sat Dec 03, 2005 1:16 am    Post subject: Re: Arctan or Arccos? Reply with quote

Tim Wescott wrote:
Quote:
Real_McCoy wrote:
I remember a mathematician saying to me a while back that engineers always
work out phase using arctan (img/real).

He went on to say that this was not a good method due to problems with
quadrants etc. Far better to use arccos(real/abs) if my sums are right.

Either one leads to ambiguities.

perhaps that mathematician was thinking of this:

Arg(z) = sgn( Im(z) ) * Arccos( Re(z) / |z| )

that works for all 4 quadrants and gives you the principle value of
arg() but of course has some numerical problems for the case where z is
real.

r b-j
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> DSP All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB