Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Uniform distribution with constraints

Subject: Uniform distribution with constraints

From: Liana

Date: 7 Apr, 2011 20:15:08

Message: 1 of 3

Hello,

I need to generate 100 uniformly distributed random numbers that are outside the convex hull.

The convex hull is defined as follows:
obst = DelaunayTri(vertices);
ch = convexHull(obst);

Random numbers are generated as follows:
randpoint(:,1) = unifrnd(xmin(1,1), xmax(1,1), 100, 1);
randpoint(:,2) = unifrnd(xmin(2,1),xmax(2,1), 100, 1);
randpoint(:,3) = unifrnd(xmin(3,1), xmax(3,1), 100, 1);

The question is if I can use the condition 'inhull(randpoint,vertices,ch) ~= 1' directly in the 'unifrnd' function? Or the only way is to use 'for...end' statement and at each ith iteration check if the ith random point satisfies the condition?

Thanks.

Subject: Uniform distribution with constraints

From: ImageAnalyst

Date: 7 Apr, 2011 20:24:34

Message: 2 of 3

I don't have that toolbox so I can't get the help for unifrnd and
inhull. But I would think that checking every point to see that it's
outside the hull is the only way. The good news is that for only 100
points it will happen in a bazillionth of a femtosecond.

Subject: Uniform distribution with constraints

From: Liana

Date: 7 Apr, 2011 20:42:05

Message: 3 of 3

Ok, thank you.
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <e22b9ec3-2e71-4ba9-a880-6398d15cd5a0@e8g2000vbz.googlegroups.com>...
> I don't have that toolbox so I can't get the help for unifrnd and
> inhull. But I would think that checking every point to see that it's
> outside the hull is the only way. The good news is that for only 100
> points it will happen in a bazillionth of a femtosecond.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us