One-dimensional mode filtering. Applies an order 2*r+1 one-dimensional mode filter to vector x. That is each element of the output y(i) corresponds to the mode of x(i-s/2:i+s/2). At boundary regions, y is calculated on smaller windows, for example y(1) is calculated over x(1:1+s/2). Note that for this function to make sense x should take on only a number of discrete values. INPUTS x - length n vector s - filter size OUTPUTS y - filtered vector x EXAMPLE x=[0, 1, 0, 0, 0, 3, 0, 1, 3, 1, 2, 2, 0, 1]; s=4; ymedian = medfilt1( x, s ); ymode = modefilt1( x, s ); [x; ymedian; ymode] DATESTAMP 29-Sep-2005 2:00pm See also MEDFILT1