Signal Processing Toolbox Help Desk

medfilt1

Purpose

One-dimensional median filtering.

Syntax

Description

y = medfilt1(x,n) applies an order n, one-dimensional median filter to vector x. y is the same length as x; the function treats the signal as if it is 0 beyond the end points.

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-1)/2 and ((n-1)/2)+1 elements.

The default for n is 3.

y = medfilt1(x,n,blksz) uses a 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 is 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.

See Also

filter

Filter data with a recursive (IIR) or nonrecursive (FIR) filter.

medfilt2

Two-dimensional median filtering (see Image Processing Toolbox User's Guide).

median

Median value (see MATLAB Function Reference).

References

[1] Pratt,W.K. Digital Image Processing. New York: John Wiley & Sons, 1978. Pgs. 330-333.



[ Previous | Help Desk | Next ]