Signal Processing Toolbox |
One-dimensional median filtering
Syntax
Description
y
applies an order =
medfilt1(x,n)
n
one-dimensional median filter to vector x
; the function considers the signal to be 0 beyond the end points. Output y
has the same length as x
.
For n odd, y(k)
is the median of x(k-(n-1)/2:k+(n-1)/2)
.
For n
even, y(k)
is the median of x(k-n/2)
, x(k-(n/2)+1)
, ..., x(k+(n/2)-1)
. In this case, medfilt1
sorts the numbers, then takes the average of the n/2
and (n/2)+1
elements.
y
uses a =
medfilt1(x,n,blksz)
for
-loop to compute blksz
(block size) output samples at a time. Use blksz
<< length(x)
if you are low on memory, since medfilt1
uses a working matrix of size n-by-blksz
. By default, blksz = length(x)
; this provides the fastest execution if you have sufficient memory.
If x
is a matrix, medfilt1
median filters its columns using
in a loop over the columns of x
.
y
specifies the dimension, =
medfilt1(x,n,blksz,dim)
dim
, along which the filter operates.
See Also
References
[1] Pratt, W.K., Digital Image Processing, John Wiley & Sons, 1978, pp. 330-333.
maxflat | modulate |
© 1994-2005 The MathWorks, Inc.