I have a two column data of Te2000 and Ar2000. I can plot the points and their boundary without any issue like this:
plot(Te2000, Ar2000, 'b.')
k1 = boundary(Te2000,Ar2000);
hold on;
plot(Te2000(k1), Ar2000(k1));
My goal is to get a tighter boundary that only covers 90% of the points, so I tried the below code:
plot(Te2000, Ar2000, 'b.')
k1 = boundary(Te2000,Ar2000);
hold on;
plot(Te2000(k1), Ar2000(k1), 0.75);
Why do I get this below error?
Error using plot
Data must be a single matrix Y or a list of pairs X,Y.

 Réponse acceptée

Walter Roberson
Walter Roberson le 27 Fév 2018
Modifié(e) : Walter Roberson le 27 Fév 2018

0 votes

7 commentaires

Leon
Leon le 27 Fév 2018
Many thanks! I just tried and it worked. Here is the thing. I want to find a boundary which covers 90% of the data points, but it seems that right now the boundary covers 100% of the data points, and my only choices are either draw a smaller or larger boundary. How do I keep the outliers data with larger uncertainties out of the boundary?
Walter Roberson
Walter Roberson le 27 Fév 2018
You run into questions about what is an outlier and what is part of the regular data.
One approach is to take the centroid of the data, then convert the coordinates of all points to polar relative to the centroid. Sort by distance. Take 90% of the way through the list. Delete the points in the last 10% from the list of coordinates. boundary() the rest.
Leon
Leon le 27 Fév 2018
That's exactly what I want. Do you have codes to perform this? What functions should I use to convert the coordinates to polar relative to the centroid?
Many thanks.
centroid_x = mean(x_coordinates);
centroid_y = mean(y_coordinates);
[~,r] = cart2pol( x_coordinates - centroid_x, y_coordinates - centroid_y);
[~, sortidx] = sort(r);
top90 = sortidx(1:floor(length(sortidx)*9/10));
subset_x = x_coordinates(top90);
subset_y = y_coordiantes(top90);
now you can find the boundary on subset_x subset_y
Leon
Leon le 27 Fév 2018
Many thanks for the big help! I really appreciate it.
Steven Lord
Steven Lord le 27 Fév 2018
If you're using release R2017a or later, check if any of the methods available in the isoutlier function detects outliers in such a way that matches your intuition and/or expectations.
Leon
Leon le 28 Fév 2018
Many thanks for the tip!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by