How do I remove outliers in data so that vectors are of the same length for plotting?
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Please see the attached excel file.
X = First column data
Y = Second column data
I have to ensure that both the vectors are of the same length for plotting and curve-fitting purpose. How do I get rid of the outliers in the Y-values such that the corresponding X-values are also lost?
0 commentaires
Réponse acceptée
Matt J
le 12 Juin 2024
Perhaps something like this,
[Y,discard]=rmoutliers(Y);
X(discard)=[];
0 commentaires
Plus de réponses (1)
Shivani
le 12 Juin 2024
Modifié(e) : Shivani
le 12 Juin 2024
Hello @Vikash Pandey
Based on my understanding, the 'rmoutlier' would be the correct function to obtain the results you are looking for. The documentation states that,
- If A is a matrix, then rmoutliers detects outliers in each column of A separately and removes the entire row.
You will need to replace column 'A' with 'y' in the above example. This will identify all outliers in column 'y' and remove the corresponding rows, ensuring that 'x' is also removed.
I am attaching MATLAB documentation links that provide further information on this below for your reference:
- https://www.mathworks.com/help/matlab/ref/rmoutliers.html
- https://www.mathworks.com/help/curvefit/removing-outliers.html
- https://www.mathworks.com/help/matlab/data_analysis/data-smoothing-and-outlier-detection.html
- https://www.mathworks.com/help/matlab/ref/cleanoutlierdata.html
- https://www.mathworks.com/help/thingspeak/remove-outliers-in-your-data.html
Additionally, you can also refer to the following MATLAB answer thread for more details:
0 commentaires
Voir également
Catégories
En savoir plus sur Measurements and Feature Extraction dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!