How do I remove outliers in data so that vectors are of the same length for plotting?

10 ビュー (過去 30 日間)
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?

採用された回答

Matt J
Matt J 2024 年 6 月 12 日
Perhaps something like this,
[Y,discard]=rmoutliers(Y);
X(discard)=[];

その他の回答 (1 件)

Shivani
Shivani 2024 年 6 月 12 日
編集済み: Shivani 2024 年 6 月 12 日
Based on my understanding, the 'rmoutlier' would be the correct function to obtain the results you are looking for. The documentation states that,
B = rmoutliers(A) detects and removes outliers from the data in A.
  • 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:
Additionally, you can also refer to the following MATLAB answer thread for more details:

カテゴリ

Help Center および File ExchangeMeasurements and Feature Extraction についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by