Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Uniform random rotation matrix
Date: Thu, 9 Dec 2010 22:12:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <idrk7l$1sn$1@fred.mathworks.com>
References: <idr87f$ho7$1@fred.mathworks.com> <idr8mi$q71$1@fred.mathworks.com> <idrfee$3iu$1@fred.mathworks.com> <idrg69$hrj$1@fred.mathworks.com> <idrgpg$so6$1@fred.mathworks.com> <idri4m$nuc$1@fred.mathworks.com> <idriop$5q2$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1291932725 1943 172.30.248.37 (9 Dec 2010 22:12:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 9 Dec 2010 22:12:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:694048

"John D'Errico" <woodchips@rochester.rr.com> wrote in message <idriop$5q2$1@fred.mathworks.com>...
> "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <idri4m$nuc$1@fred.mathworks.com>...
> > The above has flaw, but my original method without shifting
> > 
> > > [q,~] = qr(randn(2));
> > 
> 
> Yes it does have a flaw. Have you tried my example
> for randn?
> 
> LOOK AT THE RESULT. Does it look unbiased?
> 
> John
- - - - - - -
  John, I think there is a communication difficulty here.  In the example you showed with randn you subtracted .5 from it.  That is NOT what Bruno suggested.  He wrote: "[Q, ~] = qr(randn(ndim))" in his first posting.

  In your example where you have ang(i,2) = atan2(q(1,1),q(2,1)) this angle will be the same as atan2(r2,r1) where [r1;r2] are the first column in the qr argument.  With randn alone without .5 subtracted that angle should be uniformly distributed in [0,2*pi].

Roger Stafford