![]() |
trig
does anybody know the trigonometry code? is there a math.h file in mplab?
|
Re: trig
im not sure but did you try
#inculde<math.h> at the top |
Re: trig
Yes, there is a math.h. However, use it with caution, the RC is notorious for bogging down on complex mathematics, especially floating point operations. A good workaround is the trig lookup tables in stored in the microcontroller's eeprom, which Kevin Watson has already written code to do. (linked to here)
|
Re: trig
the only problem is that kevin's code only does sine and cosine. we need inverse tangent, though. any suggestions? and does anyone have the functions created to do this?
|
Re: trig
there used to be some code floating around for it that was develop by a team a few years back to be able to do floating point math.....kinda.....ill see if i can find it again, or maybe some nice person will post a link
[EDIT] found it http://www.chiefdelphi.com/media/papers/1575 [/EDIT] hope it helps....i don't like to mess with trig on this hardware, but this made life a little easier.... |
Re: trig
thank you thank you thank you....thats EXACTLY whal i was looking for!!!!!!!!
|
Re: trig
You can also approximation trig functions using a finite number of terms from the Taylor series.
For instance, arctan(x) is approximately equal to X - X^3/3 + X^5/5 - X^7/7 When -1<X<1 I'm not a coder, so I don't know what you’re trying to do, but from what I do understand about code, a Taylor series approximation should be fairly easy to implement. |
Re: trig
Quote:
|
| All times are GMT -5. The time now is 00:20. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi