From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: mean direction
Date: Tue, 31 May 2011 17:45:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <is39f1$c91$>
References: <is2b3o$bu9$> <> <> <is2obf$ev6$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1306863905 12577 (31 May 2011 17:45:05 GMT)
NNTP-Posting-Date: Tue, 31 May 2011 17:45:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:729535

"ClauDe" wrote in message <is2obf$ev6$>...
> Hey TideMan,
> thanks a lot. 
> Now the result is as I thought it should be! :-)
> Take care
- - - - - - - - - -
  There is another possibility.  It depends on whether you wish to weight your mean computation by the strength of the wind or not.  If you do, then Tideman's solution is the right way to proceed.  If all winds are to be weighted equally independent of their intensity, you should do this:

 d = 180/pi*angle(mean((v+i*u)./abs(v+i*u)))

  You can also get the same result with

 r = sqrt(u.^2+v.^2);
 d = 180/pi*atan2(mean(u./r),mean(v./r));

  As Tideman indicates, you should never attempt to take the mean value of angles.  It will lead to nonsense.

Roger Stafford