Chris4321 0 Report post Posted December 10, 2018 Hello, I need to use fxATan2 block to decode the angle value. I need an efficient way to do this so I am using fixed-point blocks. The issue is that I am not able to extract the angle value using fixed point arc tan block. I was not a problem decoding angle value from normal atan block. I have attached a simulation file. Please check and advise me what changes are needed to be done. Note: I have tried converting the sin/cos to per unit as recommended in help. With both fx1.16 & fx1.32 based data types but nothing worked. If there is another efficient way to do this then please recommend as atan is itself quite inefficient. fxATan2_test.vsm Quote Share this post Link to post Share on other sites

peterd 0 Report post Posted December 14, 2018 Atan2(sin(θ), cos(θ)) uniquely determines angle throughout a full 2pi rotation. A single arctan(sin(θ)/cos(θ)) is ambiguous since negative valued sin(θ)/positive cos(θ) has the same value as positive sin(θ)/negative cos(θ) Additionally, using atan2 in fixed point is computationally faster and more precise than dividing sin/cos and then doing arctan(). The result angle of fxAtan2 ranges from 0 to 1, atan2 ranges from -π to π In the plot above we use 1 Hz sin and cos. Quote Share this post Link to post Share on other sites