Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Generate random points on a circular sector Date: Sun, 6 May 2012 17:42:08 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 11 Message-ID: <jo6d5g$7hc$1@newscl01ah.mathworks.com> References: <jo6784$eqn$1@newscl01ah.mathworks.com> <jo68g9$aj5$1@speranza.aioe.org> <jo6b0h$h18$1@speranza.aioe.org> Reply-To: <HIDDEN> NNTP-Posting-Host: www-04-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1336326128 7724 172.30.248.35 (6 May 2012 17:42:08 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sun, 6 May 2012 17:42:08 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:767008 "Nasser M. Abbasi" <nma@12000.org> wrote in message <jo6b0h$h18$1@speranza.aioe.org>... > N = 30; %how many points > w = pi/4; %range of anlge [-w,w] > r = 1; %radius > angle = -w+2*w*rand(N,1); > rad = r*rand(N,1); > polar(angle,rad,'or') - - - - - - - - Nasser, what Bruno is objecting is that without the square root operation on the radius calculation the distribution of points you will get is not uniform area-wise. If you take a careful look at the results of your own code with a large N, say N = 1000, you will see that the points are much more concentrated at the circle's center than at its circumference. Use "rad = r*sqrt(rand(N,1))" instead and you can easily see the difference. Roger Stafford