There may some shipping delays at this time, orders placed on Fri Jan 22, may not ship for 1-2 business days.

using ATAN..HELP..I am new at this

Help! I am new at this. I am trying to get the atan of a Y value and a Z value.

for example if my Y value is 0.59 and my Z value is 0.87, then we have:

degrees = arctan of (0.59/0.87)
degrees = arctan (0.6782)
degrees = 34.14

So, how do I insert this into my sketch?

I tried

xdeg = atan (yValue / zValue);

This returns a number that is NOT the accurate degree measurement. BTW, xdeg was declared as
a float variable. Also yValue and zValue were declared as float.

I am get data for xdeg, but not the accurate degree result, instead, when for example Y=.59 and Z=.87, I get xdeg as 0.61...that is clearly not 34.14 degrees.

So how do I use atan to get the arctan (in degrees) of any variable?

thanks and HELP! 4x1ks

Posts: 3
Joined: Fri Sep 06, 2019 5:57 am

Re: using ATAN..HELP..I am new at this

To convert radians to degrees, multiply by 180 and divide by pi. Posts: 79929
Joined: Sat Feb 07, 2009 10:11 am

Re: using ATAN..HELP..I am new at this

actually, my question is simpler than that now that I think about it. What I want to do is to take a number (e.g. .689) which is the result of dividing a variable Y by a variable Z, and then take the atan of that number.... for example:

I get data from my program and I could have a pair of numbers such as Y = 0.59 and Z = 0.87

So all I want to write into my sketch is:

Result = atan (Y / Z)

I need to know how to write that. When I just take the numbers and do them on my HP calculator I always get the correct answer. When I try to use the atan function in my sketch I always get errors. thanks. 4x1ks

Posts: 3
Joined: Fri Sep 06, 2019 5:57 am

Re: using ATAN..HELP..I am new at this

ok...it is working. I am getting precise degree measurements now. thanks 4x1ks

Posts: 3
Joined: Fri Sep 06, 2019 5:57 am

Re: using ATAN..HELP..I am new at this

Good to hear. Thanks for the update. 