>-----Original Message----- >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] >On Behalf Of Wouter van Ooijen >Sent: 16 September 2004 15:00 >To: 'Microcontroller discussion list - Public.' >Subject: RE: [OT] cyclic average. > > >> The problem is the discontinuity in the number system being >> used. Creating a continuous wrap around number system >> representing the compass as 0 to 179 180 -179 to -1 makes all >> of the averaging problems go away. Conversion of negative >> numbers requires a simple add of 360. > >So which formula would you use to calculate the average? >Simple sum(Xi)/N does not work: take 170 and -170, sum = 0, >average would be 0, correct answer is 180. Actually, 180 is one correct answer, 0 is the other. Given two arbitrary points to average between and no other inforamtion, you do not know how the heading is varying between samples. One would naturaly assume that it would be the smaller angle, but there are no guarantees. Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist