medfilt1m

PURPOSE ^

One-dimensional adaptive median filtering with missing values.

SYNOPSIS ^

function y = medfilt1m( x, r, z )

DESCRIPTION ^

 One-dimensional adaptive median filtering with missing values.

 Applies a width s=2*r+1 one-dimensional median filter to vector x, which
 may contain missing values (elements equal to z). If x contains no
 missing values, y(j) is set to the median of x(j-r:j+r). If x contains
 missing values, y(j) is set to the median of x(j-R:j+R), where R is the
 smallest radius such that sum(valid(x(j-R:j+R)))>=s, i.e. the number of
 valid values in the window is at least s (a value x is valid x~=z). Note
 that the radius R is adaptive and can vary as a function of j.

 This function uses a modified version of medfilt1.m from Matlab's 'Signal
 Processing Toolbox'. Note that if x contains no missing values,
 medfilt1m(x) and medfilt1(x) are identical execpt at boundary regions.

 USAGE
  y = medfilt1m( x, r, [z] )

 INPUTS
  x      - [nx1] length n vector with possible missing entries
  r      - filter radius
  z      - [NaN] element that represents missing entries

 OUTPUTS
  y      - [nx1] filtered vector x

 EXAMPLE
  x=repmat((1:4)',1,5)'; x=x(:)'; x0=x;
  n=length(x); x(rand(n,1)>.8)=NaN;
  y = medfilt1m(x,2); [x0; x; y; x0-y]

 See also MODEFILT1, MEDFILT1

 Piotr's Computer Vision Matlab Toolbox      Version 2.35
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]

Generated by m2html © 2003