View Full Version : Question Lookup tables and Interpolation ?
ryan.reeve
Apr 21, 2008, 01:42 PM
Guys...
Anyone has idea about creating Lookup tables implementing Interpolation
and approximation for computing sine.Any code snippet will be welcomed.
Ginger Adam
Apr 21, 2008, 02:56 PM
http://en.wikipedia.org/wiki/Lookup_table#Computing_sines
Reading that took me back about 25 years......
Adam
ryan.reeve
Apr 22, 2008, 06:49 AM
I already did.But is this method ok for computing bearing from GPS cordinates.
Do we get the required accuracy and what about interpolation.
http://en.wikipedia.org/wiki/Lookup_table#Computing_sines
Reading that took me back about 25 years......
Adam
Ginger Adam
Apr 22, 2008, 07:00 AM
Not really qualified to answer that - last time I played around with code like that (college) it was for cheapie ground-based robots to navigate and it was more than up to the job for that.
If the new bearing is being recalculated periodically from updated GPS data then a degree or two of initial error is probably not that serious ?
You could perhaps model the code and see how it compares to sin() and then take a view ?
Adam
ryan.reeve
Apr 24, 2008, 03:14 AM
Thanks Adam,
I cant really understand how that table, on wikipedia, was constructed and how to use it I mean if i want to sin of 45, let say then ....
Can u please elaborate that.
Ginger Adam
Apr 24, 2008, 04:26 AM
Just to be sure we're talking about the same requirement/method (email/BBS can sometimes be a confusing way of communicating):
At college we were doing work on a ground based robot that used an 8-bit processor, coded using assembler. Can't remember what the CPU was, probably a 6502 (they were all over the place in those days). We had a requirement to use trig to work out vectors, but quickly found that there was no suitable way to compute these. We implemented a lookup, the values of which were 7 bit + sign . This table was computed using a PET computer which has BASIC interpreter (and so had sin() + cos() functions, and then flashed into the EPROM with the code. I can't remember what size this table had (I seem to recall we went with 256 bytes for obvious reasons - so not even 1 degree resolution), but we did not need to use interpolation as the Wiki version seems to suggest, so it was probably quite unsophisticated. One table can do both Sin and Cos by using different offset.
If it helps, I'll see if I can find my A-Level project notes, but I'd imagine the world has moved on somewhat since then :) - we all marvelled when the 6502 went decimal, and I stopped playing around with this stuff shortly after the 68000 chip came along. Working at this level really makes you appreciate high level languages !
HTH - sorry if I'm totally off beam.
Adam
vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.