Hello Everyone ,
I have a set of points which are stored in n*3 MATRIX. These are points from a sensor and at the starting and ending there is a lot of disturbance in the signal and I get points which are very close to each other. I have to remove these points. So I check the distance between points starting from the first point and whenever I get a point outside a user input radius I break the loop.
The problem is I want to make a new array of dimensions m*3 in which I have the first point of my Input array then next (x) points are removed and then i get the remaining points.
Can someone help me with this?
No products are associated with this question.
I'm not sure if I understood the concept of your "points" correctly. But perhaops you want something like this:
X = cumsum(rand(1000, 3)); % Test data keep = false(1000, 1); radius = 0.7; radius_2 = radius ^ 2; % Avoid the expensive SQRT
orig = X(1, :); keep(1) = true; for ii = 2:1000 dist_2 = sum((X(ii, :) - orig) .^ 2); if dist_2 > radius_2 keep(ii) = true; orig = X(ii, :); end end CleanedX = X(keep, :);
Play games and win prizes!Learn more