|
Post by Camerart on Apr 10, 2018 9:45:12 GMT
Hi T, I've looked at it as I did, my sons book he's throwing away, see attachment, and my eyes roll. I can weld and paint you a painting, but not maths sorry. c.
|
|
|
Post by B+ on Apr 10, 2018 12:34:09 GMT
Good Lord! Predicate Calculus 2 that is a level of abstraction way, way beyond x, y coordinates and trig used to decide whether a verbal argument has been properly constructed on not, a subject as much pure Logic and Rhetoric or Philosophy as Mathematics.
Trying to understand that before trig or Algebra is like trying to understand Algebra before Arithmetic.
I am wondering if your built in Arc Tan is not working because you are using x / y instead of y / x.
Try that first! Your answer will likely be in Radians so multiply by 180/pi to get a Degree Angle to judge whether the built in Arc Tan is working or not.
With x, y coordinates: x is a distance that runs horizontally like the x axis.
y is a distance that runs vertically like the y axis (which by the way, increases as you go down in BASIC programming screens unlike how you learned it in math class).
Tangent or TAN (of an right angle) is simply the ratio = y/x of the y and x legs of a right triangle.
Arc Tangent (of a ratio y/x) is simply the Angle that makes a y/x slope or Tangent ratio.
What usually adds an agonizing amount of confusion is that all angles are expressed in Radians and not Degrees when using Trig formulas much like the difference between the English system of measuring lengths and the Metric System, so you need to know conversions like 1 inch is about 2.54 cm
Degree Angle * pi/180 = Radian Angle
Radian Angle * 180/pi = Degree Angle
So this formula is automatically converting Radians to Degrees, that is what the, *180/pi, part is doing: arctn= x /y /( 1+0.28125 *( x /y ) *( x /y)) *180 /pi
Append: I suppose to be more technically correct the Tangent of an angle (of a right triangle) is the side or leg opposite the angle / (over) the side or leg adjacent to the angle so depending on what angle you are referring to the ratio could be either x/y or y/x, these ratios run from 0 to 1.
|
|
|
Post by B+ on Apr 10, 2018 13:45:13 GMT
www.researchgate.net/publication/3321505_Another_Contender_in_the_Arctangent_RaceMore about Richard Lyons formula: Complex numbers I + iQ are usually graphed I = x leg and Q = y leg so I + iQ ==> (x, y) or Q / I ==> y / x Formula becomes: arctan(y/x) = (y/x) / (1 + .28125 * (y/x)^2 ) rad x/y will work if used the same throughout, just not Standard use of x and y. Also notice "rad" at the end of it. It is in Radians so *180/pi was added to convert to Degrees. Append: I suppose to be more technically correct the Tangent of an angle (of a right triangle) is the side or leg opposite the angle / (over) the side or leg adjacent to the angle so depending on what angle you are referring to, the ratio could be either x/y or y/x, these ratios run from 0 to 1.
|
|
|
Post by Camerart on Apr 10, 2018 17:07:16 GMT
Hi, Post #2 satisfied my initial question, thanks to T.
I've changed my program using the equation, and given it substitute numbers, which give the correct results.
The Compass module however is not giving the correct outputs, as the results are quite incorrect.
When I mounted the module on the test PCB, I had to guess which direction was North. I did it from the results, but didn't notice how far out they were, until further tests.
Looking again at the DATA sheet, it's possible that it is mounted 90º out, but now pointing North, the output (after the equation) stalls.
From what some of you have said. Is it possible that it has been 90º out all the time, and the equation should have all of the X and Ys reversed?
C.
|
|