How to generate clustered or linearly distriuted random points in a plane?

10 views (last 30 days)
Hi, I need to generate a set of random points (say 100 points) in the cartesian plane. The x and y values can range from 0 to 1, but there should be more points towards the bottom of the plane.... say maybe 40 or 45 of the points must have a y value less than 0.3... Is it possible?
Lekshmi
Edit : Is it possible to just distribute the points linearly along the y direction? That is, the points must be densely placed nearer zero, and get sparser as we move to 1. The whole thing must be more or less random with regard to placement of the points, but biased towards the bottom.... and the distribution must be linear. My knowledge of statistics is pretty bad.. so i dont know how exactly to put it.

Accepted Answer

Wayne King
Wayne King on 1 Jan 2014
Edited: Wayne King on 1 Jan 2014
Do you have the Statistics Toolbox?
If so, how about using a Beta random variable for your Y and a uniform random variable for X -- you did not state that the X should be clustered in any portion of the plane.
The Beta distributions has two parameters, A and B, the expected value is A/(A+B)
Below I'll use a Beta RV with an expected value of 1/3.
y = betarnd(2,4,100,1);
x = rand(100,1);
XY = [x y];
Visualize
plot(XY(:,1),XY(:,2),'*')
If you execute the following, you'll see by the Beta(2,4) PDF why a majority of the points will be concentrated closer to 0.3 than 1.
x = 0:0.01:1;
y = betapdf(x,2,4);
plot(x,y)
Of course you can play with the parameters to obtain the Y distribution you want.
y = betapdf(x,1,5);
plot(x,y)

More Answers (1)

Image Analyst
Image Analyst on 1 Jan 2014
If you have the Image Processing Toolbox, you can create an image of clusters by making random noise thenmasking it with Gaussians placed randomly around the image. Control the level of clustering by changing a single threshold. See attached m-file for the code to produce an image like this:

Categories

Find more on Random Number Generation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!