> >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. I don't understand that. Your encoding uses -180 ... + 180 for the full circle, so 170 and -170 are pretty close, just 20 degrees apart, so there is only one average (south, if 0 is north). Wouter van Ooijen -- ------------------------------------------- Van Ooijen Technische Informatica: www.voti.nl consultancy, development, PICmicro products docent Hogeschool van Utrecht: www.voti.nl/hvu _______________________________________________ http://www.piclist.com View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist