フィルターのクリア

Finding Max and Min while ignoring a specific range

21 ビュー (過去 30 日間)
Marcus Solis
Marcus Solis 2017 年 6 月 13 日
コメント済み: Adam 2017 年 6 月 14 日
Hi All,
I am trying to find the max/min of a single column of data. Normally I would use the max(X) and min(X), but this particular dataset has spikes I'd like to ignore. The values tend to be roughly -.010 < X < .010, but there are some instantaneous spikes within the data around +/-100. Is there a way to get the max and min while ignoring these spikes?
For example:
If X < 1 AND X > -1 Then max(X) AND min(X) Else Ignore
Hope this makes sense. Thanks in advance for your help! -Marcus

回答 (1 件)

Adam
Adam 2017 年 6 月 13 日
編集済み: Adam 2017 年 6 月 13 日
max( X( X < 0.01 ) )
min( X( X > -0.01 ) )
should work?
  3 件のコメント
Marcus Solis
Marcus Solis 2017 年 6 月 13 日
My problem is that I want to ignore the sudden dropoff in the attached plot. I'm using the following to get the minimum and maximum:
ErrPriMax = ErrorPri<1;
ErrorPriMax = max(ErrorPri(ErrPriMax));
ErrPriMin = ErrorPri>-.4;
ErrorPriMin = min(ErrorPri(ErrPriMin));
ErrRedMax = ErrorRed<1;
ErrorRedMax = max(ErrorRed(ErrRedMax));
ErrRedMin = ErrorRed>-.4;
ErrorRedMin = min(ErrorRed(ErrRedMin));
The correct minimums should be around -.2 for the primary error and -.05 for the redundant error; however, I am getting around -.4 for both since that is the hard limit I coded in. Is there a better way to do this? I essentially want to ignore the two spikes.
ErrorPri and ErrorRed are the datasets I am working with along with Time. They dont go to infinite, they go more closely to -20 (which is far greater than reality).
Any help is greatly appreciated.
Thank You!
Adam
Adam 2017 年 6 月 14 日
You could try running a non-aggressive smoothing filter to try to get ride of the outliers, but that will diminish your magnitudes elsewhere too. You can't really do much without getting rid of the erroneous data though.

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

カテゴリ

Help Center および File ExchangeSmoothing and Denoising についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by