To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.org.ca.rtltorontoOpen lugnet.org.ca.rtltoronto in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Organizations / Canada / rtlToronto / 14260
14259  |  14261
Subject: 
OT: Math Help
Newsgroups: 
lugnet.org.ca.rtltoronto
Date: 
Fri, 5 Aug 2005 19:25:52 GMT
Viewed: 
535 times
  
Figured I'd bounce this problem off the smart people in
RTLTotonto...This was posted on an automation mailing list, with
little resolution:

I have a weather station which measures both the direction and speed
of the wind and is connected to a PC to record this data.

How would I calculating the average direction of the wind for a time interval?

The problem is that the direction 0 degrees and 360 degrees are the
same (North). Let's say that the wind is from the north; if I have
e.g. 4 samples and half of them are 350 degrees and the other half are
10 degrees the mathematical average is (10+10+350+350) / 4 = 180
degrees! This is mathematically right result but it should be 0.

Similarly, taking a 360 modulus before dividing but this fails too.
For example ((100+100+100+100) modulo 360) / 4 = 10 (incorrect, should
be 100).

Using trig, for each value accumulate the sum of the sines and the sum
of the cosines. Then divide each of these sums by the number of
entries to get:
x = average cosine and y = average sine. Then use the arctan2 function
to get the average angle as: Angle = arctan2( x , y), except this
fails if x=0 and y=0, as would be the case when trying to average 90
and 270, sot here is no simple solution to that problem with trig...

So any smart people up to the challenge?

-Rob A>



Message has 3 Replies:
  Re: OT: Math Help
 
(...) I think using vector math (as you do above) is the right way to go. As for the special cases, meh, deal with it :) (19 years ago, 5-Aug-05, to lugnet.org.ca.rtltoronto)
  Re: OT: Math Help
 
(...) Here a detailed explanation I found puttering with google. I can't remember how to solve these equations anymore. So have fun. :-) (URL) (19 years ago, 5-Aug-05, to lugnet.org.ca.rtltoronto)
  Re: OT: Math Help
 
(...) If I remember right, the way we resolved this for real-world surveying problems and the like was to convert the degrees 180 < x < 360 into negative values relative to 0/north. 350 is -10, 270 is -90, etc. If x1 > 180 then x2 = 360 - x1 This (...) (19 years ago, 5-Aug-05, to lugnet.org.ca.rtltoronto)

9 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR