Remove 2D points that exceed std dev in either axis

3 views (last 30 days)
I have a bunch of 2D points. I want to find the truncated mean and the standard deviation in each dimension based on the truncated data, then keep the points that are within a standard deviation of either the x-mean or the y-mean.
What I've done so far is to create two copies of the data, one sorted on x and the other on y. Then, I cut off some threshold percentage from the top and bottom of each of these copies, and find the mean and standard deviation of each. I then find the data in each copy that is within a standard deviation of this truncated mean for the given copy. That is, if it's the x-sorted copy, find the points that are within a standard deviation of the truncated x mean. Now, I want to keep the points that are in either copy, but I need them to be in the same order as the original data. How would this be done?

Accepted Answer

Thorsten
Thorsten on 7 Oct 2015
Edited: Thorsten on 7 Oct 2015
You can determine the cut-off threshold on the sorted data but remove the values from the top and the bottom in the unsorted data. Note that you have to identify indices where both x and y are valid, and change x and y with these indices. Otherwise you end up with x and y values that to not match.
For further advice please post your code.

More Answers (0)

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!