LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem: Creating groups out of a set of points in 2D space based on their relative proximity

Solved!
Go to solution

Hi,

 

I'm new to LabVIEW and I've tried doing this several times, but I just can't solve it.

 

Problem:

I've got a set of points in the 2D space(x,y), and I want to calculate the mean of the sets of closely spaced points.

 

Example:

Consider 5 points, A(1,2); B(2,3); C(100,200); D(120,220); E(110,210); F(500,600)

 

I'm trying to get the output a set of points

P[ (1+2)/2 , (2+3)/2 ]

Q[ (100+120+110)/3, (200+210+220)/3 ]

S[ 500, 600 ]

 

Where the outputs are the means of the points taken in sets which are composed of "closely" paced points(within a limit).

I.e.., (A,B) are close; (C,D,E) are close, while E is separated from the rest, within a small limit(say 30).

 

This has been causing a lot of problems for me recently and I have to solve it. Image included.

 

Any suggestions/ideas are most welcome.

Thanks in advance.

0 Kudos
Message 1 of 6
(2,844 Views)
Solution
Accepted by topic author nesslersreagent

Problem solved.

 

Constructed a VI that handles the task well.

Attached image shows the idea.

 

Works quite well now with great results.

0 Kudos
Message 2 of 6
(2,817 Views)

nesslersreagent wrote:

Attached image shows the idea.


Where?

0 Kudos
Message 3 of 6
(2,808 Views)

Sorry, I meant the image posted earlier.(1st post)

I'm successfully getting the desired output.

0 Kudos
Message 4 of 6
(2,806 Views)

I thought you are going to show you your solution. Showing the problem once more seems a bit redundant. 😄

 

Your problem has to do with cluster analysis, and as such, there have been many well known algorithms developed by very smart people. Did you simply implement one of those? How well does it scale with data size?

0 Kudos
Message 5 of 6
(2,790 Views)

Hi,

 

"Data clustering" is exactly what I was looking for, and I checked the link. Very informative. Thanks on that. Smiley Happy

 

I didn't post my code intentionally because it's very cluttered and inefficient.(I've just started using Labview).

But my Algorithm is simple and trivial.


1. Take any one point and compare it with every other point within a limit(say L).

 

2. If comparable, then add an entry into a 2D array, if non-existent else just ignore(points have already been accounted for).

    (The 2Darray  has each column representing a collection of comparable points,i.e. 1 group and N such columns for N point in all)

 

3. Repeat steps 1 and 2 for the remaining points.

 

4. Finally, construct a 1D array, with each element representing the mean point based on values taken per column from the 2D array.


Also, this Algorithm works fine for my application(less than 30 points), so I haven't tested it for a large number of points.

I bet It'll be highly inefficient, considering the more widely use clustering algorithms out there.

 

However, if you know of any VI's or simple algorithms for such(small data set), it would be highly beneficial to me.

Message 6 of 6
(2,785 Views)