Set values in defined area on zero

1 回表示 (過去 30 日間)
Stwiwi
Stwiwi 2018 年 9 月 13 日
コメント済み: Matt J 2018 年 9 月 14 日
Hey guys, I have this data file which creates the following plot:
I want the outliers between the two points where they cross zero to become zero. After I run my code i got this:
As you can see everything from the right of the MEAN-value is on zero but it seems like my code partially does not work because everything on the left is still there. Does anyone find the error? Or maybe someone has an easier way to erase the outliers? I attached the data file and I'm looking forward to your answers:)
  1 件のコメント
Stwiwi
Stwiwi 2018 年 9 月 13 日

This is my code and I attached the data file

load 'USS_w3'
USS_w3_POS = USS_w3(USS_w3>0);
MEAN = 2.5*mean(USS_w3_POS);
a = 1;
for z=1:length(USS_w3)
      if USS_w3(a) < MEAN
          a = a+1;
      else
          c = a;
          while USS_w3(c) > 0
              c = c+1;
          end
          USS_w3(a:c) = 0;
      end
  end
a = 1;
for z=1:length(USS_w3)
      if USS_w3(a) < MEAN
          a = a+1;
      else
          c = a;
          while USS_w3(c) > 0
              c = c-1;
          end
          USS_w3(c:a) = 0;
      end
  end

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

回答 (1 件)

Matt J
Matt J 2018 年 9 月 13 日
編集済み: Matt J 2018 年 9 月 13 日
USS_w3( isoutlier(USS_w3,'ThresholdFactor',1.5) )=0;
  2 件のコメント
Stwiwi
Stwiwi 2018 年 9 月 14 日
That's nice, but i don't just want to set every value above this outlier value on zero but the whole curve which includes the outlier value.
Matt J
Matt J 2018 年 9 月 14 日
but the whole curve which includes the outlier value.
That would mean settings all your values to zero.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by