How can I get rid of outlier data in matlab?

2 次查看(过去 30 天)
My thermocouple measures temperature in a room. However sometimes it acts weirdly and suddenly it rises from 24 to numbers like 10000.
A= [23.4 24 10000 23.7 24.1 17989]
I want to replace the terms like 10000 and 17989 with their previous neighbour element. Like;
A= [23.4 24 24 23.7 24.1 24.1]
However there are 500 of them. I need a script that makes that automatically for me. For instance a script that finds these "absurd" data and replace it with the previous "non-absurd" neighbour element.

采纳的回答

KSSV
KSSV 2017-8-28
A= [23.4 24 10000 23.7 24.1 17989] ;
absurdval = 100 ;
idx = find(A>absurdval) ; % Here any record greater thn 100 is absurd
A(idx) = A(idx-1) ;
In the above nay value greater then 100 will be replaced by it's previous value. YOu can fix your absurd value.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by