11-14-2017 03:27 PM
Hello guys
Now I am using arctan2 function in FPGA VI, the result is the output range of it is restricted to (-pi/4,pi/4). However, I think the full range of this function should be (-pi.pi). Is there anyway to solve it?
Thanks
11-14-2017 04:13 PM
My test (not on FPGA) seems to generate values between -pi/2 and pi/2. The help does say it should give values between -pi and pi though...
11-14-2017 04:20 PM
Nevermind, I generated the full range of values, just had to give x a negative value to get to the II and III quadrants.
11-14-2017 05:02 PM
I know what you mean, but things on fpga side just becomes weird, this arctan2 on FPGA side is based on cordic.
The data I sent to the arctan2 on fpga side is the sampled points of sine wave. I attached the screenshot of my code. The weird thing is if I set the input valid port to be true only if x and y is greater than 0, than the output of the arctan 2 is (0,pi/2).
So it seems this arctan2 can output more than (pi/4). So based on this, if input valid is set to constant true, output should reach the whole domain (-pi,pi). But actually not.
11-14-2017 05:27 PM
I'm not sure what data your analog input is feeding into it, but you may not be exercising the full inputs. The function will take into account the sign of the arguments (even if the argument is zero). For example, y = 0; x = 1 -> 0. y = 0; x = -1 -> pi.
11-14-2017 05:49 PM
I made a stupid mistake, now I know the reason.
Thanks....
11-15-2017 09:21 AM
@zyb1003 wrote:
I made a stupid mistake, now I know the reason.
Thanks....
You'd be surprised at how NOT stupid your mistake could be. Unless it was something like "I forgot to wire the inputs", it would be worth posting your solution. The probability is high that someone else could benefit from your experience. 🙂
11-15-2017 10:33 AM
yes. The truth is the output array is groups made of 4 different values, the (-pi/4, pi/4) is the range of the mean of the array.