Path: news.mathworks.com!not-for-mail
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$1@newscl01ah.mathworks.com>
References: <is2b3o$bu9$1@newscl01ah.mathworks.com> <767ab4ee-5d6d-4bbd-acdd-7eaf4b53ee43@k17g2000vbn.googlegroups.com> <8acc7a12-acf6-4d7f-a8a6-c7141b457aa6@x38g2000pri.googlegroups.com> <is2obf$ev6$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1306863905 12577 172.30.248.45 (31 May 2011 17:45:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 31 May 2011 17:45:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:729535

"ClauDe" wrote in message <is2obf$ev6$1@newscl01ah.mathworks.com>...
> 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