07-09-2012 07:58 AM
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.
Solved! Go to Solution.
07-10-2012 10:34 PM
Problem solved.
Constructed a VI that handles the task well.
Attached image shows the idea.
Works quite well now with great results.
07-11-2012 02:47 AM
07-11-2012 03:19 AM
Sorry, I meant the image posted earlier.(1st post)
I'm successfully getting the desired output.
07-11-2012 09:31 AM
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?
07-11-2012 10:51 AM
Hi,
"Data clustering" is exactly what I was looking for, and I checked the link. Very informative. Thanks on that.
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.