matrix - Removing extreme values in moving average (MATLAB) -


i have matrix of measurements:

a=[x1,y1;x2,y2;x3,y3] 

and device had interferences, want delete measurements (rows) above 10 times average between neighboring points (the average y values).

example:

if a=[1,1; 2,300; 3,2; 4;4]

in case, want delete second row (it's anomaly).

thank you

find moving average (considering n-1 neighbours, n must odd ):

n = 3; k = ones(n,1)/(n-1); k((n+1)/2) = 0; %//leave out point you're considering i.e. kernel [0.5,0,0.5] or [0.25,0.25,0,0.25,0.25] etc av = conv2(a, k, 'same'); 

now compare if they're 10 times bigger local average

ind = >= av*10; 

then delete rows:

a(~any(ind,2),:) 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -