DSPRelated.com
Forums

difference between atan2(x,y) and atan(x/y)

Started by maxplanck January 8, 2008
>maxplanck wrote: >> I'm a bit stumped here, maybe someone can help me out? >> >> y = atan (sin(2*pi*x) / cos(2*pi*x)); >> >> s = atan2 (sin(2*pi*x) , cos(2*pi*x)); >> >> I would expect y and s to be equal, but they're not. >> >> Most surprising to me is that the maximum value of s appears to be pi, >> despite the fact that the limit of atan2(a,b) as a/b->infinity is pi/2 >> (right?) >> >> Can anyone clue me in as to why my expectations are being defied here?
I
>> think the root of my misunderstanding lies in my not understanding the >> differences between atan(a/b) and atan2(a,b). >> >> Thanks, any help is much appreciated > >How much trig do you remember? Can you simplify sin(x)/cos(x)? Are you >familiar with the concept of "principal value"? > >Jerry >-- >Engineering is the art of making what you want from things you can get.
sin=opp/hyp cos=adj/hyp tan=opp/adj sin/cos = (opp/hyp)*(hyp/adj) = opp/adj = tan I just read up on principal value, i think that i understand the concept. Thanks for all the responses guys (both the serious and the funny ones =).