フィルターのクリア

How to remove few data points from a MATRIX

9 ビュー (過去 30 日間)
Jatin Arora
Jatin Arora 2012 年 11 月 23 日
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?
  4 件のコメント
Jan
Jan 2012 年 11 月 23 日
編集済み: Jan 2012 年 11 月 23 日
What exactly are "points" here? Are you talking about n points in the 3D space?
Posting an explicit example as Matlab code is more accurate than a text description.
Jatin Arora
Jatin Arora 2012 年 11 月 29 日
編集済み: Jatin Arora 2012 年 11 月 29 日
I would like to thank everyone who took time to read through my question and answer it. I woul like to say sorry as I could not reply due to some problem. After researching on the internet I found what exactly I want to implement.
I want to implement a Moving window filter in 3D space for cloud data of points.

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2012 年 11 月 23 日
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, :);
  3 件のコメント
Jan
Jan 2012 年 11 月 25 日
Perhaps you are right, I.A. (is the abbreviation ok? After all these years I still hesitate to call you like your profession). I thought this means the opposite: "... I get points which are very close to each other. I have to remove these points."
Image Analyst
Image Analyst 2012 年 11 月 25 日
You can call me IA - no problem. I read it as he had sensor points (3D coordinates as rows in his n*3 array) and the several rows at the top and bottom were from the sensor and they were good. The stretch in the middle were bad points "with a lot of disturbance" and he didn't want those points (rows). So he wanted to check which points were close to the very first point (which was assumed to be good), and keep those (perhaps extracted into a new array) and discard the rest. When he said "have the first point of my Input array then next (x) points are removed and then i get the remaining points." I took that to mean keep the first few good points at the beginning, remove the bad points in the middle, and keep the remaining good points at the end. But it's not totally clear and he should clarify.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by