Arctan() is a trigonometric function. It is the inverse function of the tangent function, tan(). That is,
tan(x) = y implies arctan(y) = x ; for all x
How to do the arctan operation in picbasic pro?
TQ
Arctan() is a trigonometric function. It is the inverse function of the tangent function, tan(). That is,
tan(x) = y implies arctan(y) = x ; for all x
How to do the arctan operation in picbasic pro?
TQ
Although a tad code heavy, lookup table or similar is easy and fast
in degrees
tan(0.5) = .008727 = 2/256
tan(1.5) = .026186 = 6/256
...
tan(5.5) = .09626289 = 24/256
tan(20.5) = .373885 = 95/256
tan(60.5) = 1.767494 = 452/256
tan (89.5) = 114.5887 = 29334/256
Use Excel or similar to determine all values you need for the accuracy you need (my table has all values from 0.5 to 89.5 by steps of 1, i.e., 0.5,1.5,2.5,3.5,......88.5,89.5 and therefore has 90 if-then statements) Watch for word overflow for angles above 89.77 degrees because tan(89.78) = 66671/256 and 66671 > word)
In code
atan var word
deg var byte
if atan < 29334 then deg = 89
if atan < 452 then deg = 60
if atan < 95 then deg = 20
if atan < 24 then deg = 5
if atan < 6 then deg = 1
if atan < 2 then deg = 0
Good Luck,
Paul Borgmeier
Salt Lake City, Utah
USA
Bookmarks