|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
trig
does anybody know the trigonometry code? is there a math.h file in mplab?
|
|
#2
|
||||
|
||||
|
Re: trig
im not sure but did you try
#inculde<math.h> at the top |
|
#3
|
||||
|
||||
|
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)
|
|
#4
|
||||
|
||||
|
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?
|
|
#5
|
||||
|
||||
|
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.... Last edited by Stephen Kowski : 07-05-2007 at 14:02. |
|
#6
|
||||
|
||||
|
Re: trig
thank you thank you thank you....thats EXACTLY whal i was looking for!!!!!!!!
|
|
#7
|
||||
|
||||
|
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. |
|
#8
|
||||
|
||||
|
Re: trig
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trig Lookup Table | michniewski | Programming | 6 | 23-02-2007 20:57 |
| Trig problems | revolution1737 | Programming | 8 | 19-02-2006 01:09 |
| No Trig? | The Lucas | Programming | 1 | 15-01-2004 04:07 |
| Trig | archiver | 2001 | 4 | 23-06-2002 23:14 |
| Inverse Trig | K. Skontrianos | Programming | 6 | 13-03-2002 23:27 |