-1

i am having 3D matrix in which most of the values are zeros but there are some nonzeros values.

when I am plotting this 3D matrix in matlab I am getting plot like as below

here u can see there are two groups of points are nearer to each other(that's why the color became dark) and two individual group of points is far away....

enter image description here

so my objective is to cluster that two nearer group of points and make it as one cluster1 and other two will be called as cluster2 and cluster3 ....

I tried kmeans clustering, BIC clustering...but as kmeans clustering is basically build up for 2D data input, I faced hurdle there ...then I reshape 3D matrix into 2D matrix but still I am getting another error Subscripted assignment dimension mismatch

so could u plz come out with some fruitful idea to do this......

user3168654
  • 95
  • 1
  • 11
  • 1
    I don't think e.g. `kmeans` is build for clustering 2D data – jolo Feb 13 '15 at 06:36
  • 2
    Just remember that you have to arrange your `n` 3D points in an `n x 3` matrix – jolo Feb 13 '15 at 06:37
  • Thanks for replying, I tried your suggestion. my input matrix size is 100*17*25 hence I reshape it into 2D matrix like [100*17 25]. but still i ma getting error "Empty cluster created at iteration 1". – user3168654 Feb 13 '15 at 06:51
  • 1
    You have to build an `n x 3` matrix. Bring your points into the form `point = [velocity, range, angle]`. And then you have arranged them as a `n x 3` matrix. – jolo Feb 13 '15 at 06:58
  • 1
    How did you plot the 3D matrix? If you tell us, we will be better able to understand what transform you need for your array. – Jonas Feb 13 '15 at 08:55
  • yes sure,I used vol3d function to plot 3D matrix. – user3168654 Feb 13 '15 at 09:23
  • If you just want to split that data set, define thresholds based on your visualization. i.e. angle >0°; angle < -5°; inbetween. – Has QUIT--Anony-Mousse Feb 13 '15 at 09:24
  • Thanks, that helps. Also, for clustering: I understand that two points should be considered similar if they are close in space and close in value? Finally: there are a lot of zeros or NaNs in your 3D matrix, correct? – Jonas Feb 13 '15 at 09:56

1 Answers1

2

Based on your comment that you used vol3d I assume that your data has to interpreted this way. If your data-matrix is called M, try

[A,B,C] = ind2sub(size(M),find(M));
points = [A,B,C];
idx = kmeans(points,3);

Here, I assumed that M(i,j,k) = 1 means that you have measured a point with properties i,j and k, which in your case would be velocity, angle and range.

jolo
  • 423
  • 3
  • 10