How to detect outliers in the graph

4 ビュー (過去 30 日間)
R
R 2022 年 6 月 24 日
コメント済み: Star Strider 2022 年 6 月 24 日
Hello!
I have some data plotted below and I wanted to extract the points that were outliers to the data. I was wondering how to do that. I dont want to use the minimum function as it will extract all other values that I do not require (ex. values at 14).

回答 (1 件)

Star Strider
Star Strider 2022 年 6 月 24 日
Either use findpeaks on the negative of the ‘y’ vector to get the indices of the valleys, or use islocalmin to get a logical vector of them. Set a threshold value and use those results to isolate them. Then set them to NaN and use the fillmissing function to interpolate them.
  2 件のコメント
R
R 2022 年 6 月 24 日
Thank you for your answer.
  1. I am writing an algorithm that would work with any y axis values and varying 'thresholds'. Would this work fine?
  2. Also why would we use fillmissing to interpolate?
Thanks!
Star Strider
Star Strider 2022 年 6 月 24 日
My pleasure!
1 In all likelihood, yes.
2 My approach requires setting the outliers as NaN values. The fillmissing function would then interpolate the NaN values, depending on the arguments you choose to use. (Another approach might be to use the filloutliers function, however it might be difficult to decide how to define outliers with the data presented in the original post.)
Having a .txt file with the data (independent and dependent variables), it would be easier to illustrate and experiment with this approach.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePreprocessing Data についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by