Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   National Instruments LabVIEW and Data Acquisition (http://www.chiefdelphi.com/forums/forumdisplay.php?f=149)
-   -   (FPGA) high throughput inverse tangent 2 input (http://www.chiefdelphi.com/forums/showthread.php?t=100847)

Betty Boop 21-01-2012 21:04

(FPGA) high throughput inverse tangent 2 input
 
Hello! I would just like to ask what is the effect of having a 'negative x' on the high throughput inverse tangent (2 input)? It's because when I have 'negative y' (and 'positive x'), the answer is correct. However, whenever I have 'negative x' (regardless of the sign of y), the answer would always be wrong. Thank you for your time!

Ether 21-01-2012 21:15

Re: (FPGA) high throughput inverse tangent 2 input
 
Quote:

Originally Posted by Betty Boop (Post 1110837)
Hello! I would just like to ask what is the effect of having a 'negative x' on the high throughput inverse tangent (2 input)? It's because when I have 'negative y' (and 'positive x'), the answer is correct. However, whenever I have 'negative x' (regardless of the sign of y), the answer would always be wrong.

Please give a specific (numerical) example of 2 inputs which gave a wrong output. Give the three numbers X, Y, output.


Betty Boop 21-01-2012 21:25

Re: (FPGA) high throughput inverse tangent 2 input
 
*The output is not yet multiplied to pi so that it is expressed in pi radians. :)

input: y = 1, x = 2
output: 0.1482 (correct)

input: y = -1, x = 2
output: -0.1482 (correct)

input: y = 1, x = -2
output: 0.8542 (even the sign is wrong)

input: y = -1, x=-2
output: -0.8518 (sign is again wrong and from my observation, it doesn't take into account the sign of x)

Ether 21-01-2012 21:43

Re: (FPGA) high throughput inverse tangent 2 input
 
1 Attachment(s)
Quote:

Originally Posted by Betty Boop (Post 1110858)
*The output is not yet multiplied to pi so that it is expressed in pi radians. :)

input: y = 1, x = 2
output: 0.1482 (correct)

input: y = -1, x = 2
output: -0.1482 (correct)

input: y = 1, x = -2
output: 0.8542 (even the sign is wrong)

input: y = -1, x=-2
output: -0.8518 (sign is again wrong and from my observation, it doesn't take into account the sign of x)

Those outputs are all correct. See attachment.

Starting from the +X axis and going counterclockwise, atan2 goes from 0 to +pi

Starting from the +X axis and going clockwise, atan2 goes from 0 to -pi.



Betty Boop 21-01-2012 21:46

Re: (FPGA) high throughput inverse tangent 2 input
 
ohh! sorry, sir, but can you please explain the last two cases :( I've tried manual calculation using calculator :(

Ether 21-01-2012 21:51

Re: (FPGA) high throughput inverse tangent 2 input
 
Quote:

Originally Posted by Betty Boop (Post 1110872)
ohh! sorry, sir, but can you please explain the last two cases :( I've tried manual calculation using calculator :(

I edited my original response to add some detail. Please re-read it.

Then read this article:
http://en.wikipedia.org/wiki/Atan2

Then ask me a specific question and I'll gladly help.


Betty Boop 21-01-2012 22:38

Re: (FPGA) high throughput inverse tangent 2 input
 
Hi! :D Now I understand :D THANK YOU VERY MUCH! :D

Ether 22-01-2012 08:41

Re: (FPGA) high throughput inverse tangent 2 input
 
Quote:

Originally Posted by Betty Boop (Post 1110920)
Hi! :D Now I understand :D THANK YOU VERY MUCH! :D

You're welcome.

May I ask: What is your interest in atan2? Are you taking a math class, or are you using it for FRC?


Betty Boop 22-01-2012 09:46

Re: (FPGA) high throughput inverse tangent 2 input
 
No, Sir. I'm using it in determining the phase of a signal given its I and Q data. :D


All times are GMT -5. The time now is 18:34.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi