Info

This question is closed. Reopen it to edit or answer.

Designing a Filter in MATLAB

1 view (last 30 days)
Jatin Arora
Jatin Arora on 12 Nov 2012
Closed: MATLAB Answer Bot on 20 Aug 2021
I have a matrix containing the x,y,z data of points. I want to implement a filter which removes a particular value which is due to some mathematical error
Pnts =
41.5 91.5 71.5
41.6 91.6 71.6
41.7 91.7 71.7
41.8 91.8 71.8
41.9 91.9 71.9
41.10 91.10 71.10
41.11 91.11 71.11
55.5 110.5 95.5
41.13 91.13 71.13
41.14 91.14 71.14
41.15 91.15 71.15
41.16 91.16 71.16
41.17 91.17 71.17
So the value which is 55.5 110.5 and 95.5 is a error value and has to be removed. So please someone help me how to proceed with this problem.
Thanks
  4 Comments
Jatin Arora
Jatin Arora on 12 Nov 2012
Hello ,
Mr. Roberson I am sorry for using wrong tags for my question. In future I will remember your advice. Thanks
Walter Roberson
Walter Roberson on 12 Nov 2012
You can use "Add/Edit Tags" to change the tags here.

Answers (1)

Honglei Chen
Honglei Chen on 12 Nov 2012
You need to figure out a rule yourself because other people cannot know why the specific row is an error but others are not. Using your example, assume the rule is "anything greater than 42 is an error", then you can remove the line by doing
Pnts(Pnts(:,1)>42,:) = []
  5 Comments
Jatin Arora
Jatin Arora on 12 Nov 2012
@Walter Yes I am looking for outlier detection for n*3 Matrix. @Honglei For defining the criteria I want to use a user input which can be specified in a variable.I will try to work more on the problem.
Thanks for your comments
Walter Roberson
Walter Roberson on 13 Nov 2012
Outlier detection in multiple dimensions can get a bit tricky. You could do the detection in terms of Euclidean distance (or other distance) from the centroid of all of the points together, but that can easily miss outliers that humans would pick out quickly. In particular if there are multiple clusters, it can be better to cluster the image first and then determine outliers relative to the deemed cluster.
In some cases it makes the most sense to use PCA to find the principle axes through the cloud, and then rotate the coordinates to align with those axes, and then to use something like the multi-dimensional equivalent of an ellipse aligned along the new X-Y-Z axes, with the exclusion criteria being determined according to distance from the outer shell of the ellipsoid (e.g., when one is working with points that are roughly on a surface surrounding a centroid, as opposed to working with points that are inside a surface surrounding a centroid.
If all you can say is that the points are in 3-space then the outlier detection will probably end up being pretty crude.

Tags

Community Treasure Hunt

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

Start Hunting!