<< marcumq FOSSEE Signal Processing Toolbox mexihat >>

FOSSEE Signal Processing Toolbox >> FOSSEE Signal Processing Toolbox > medfilt1

medfilt1

1D median filtering

Calling Sequence

Description

y = medfilt1(x) Applies a 3rd order 1-dimensional median filter to input x along the first non-zero dimension. The function appropriately pads the signal with zeros at the endings. For a segment, a median is calculated as the middle value (average of two middle values) for odd number number (even number) of data points. y = medfilt1(x,n) Applies a nth order 1-dimensional median filter. y = medfilt1(x,n,dim) Applies the median filter along the n-th dimension y = medfilt1(__, nanflag, padding) nanflag specifies how NaN values are treated. padding specifies the type of filtering to be performed at the signal edges.

Parameters

x:

int | double

n:

positive integer scalar

dim:

positive integer scalar

nanflag:

'includenan' (default) | 'omitnan'

* includenan:

Filtering such that the median of any segment

* omitnan:

Filtering with NaNs omitted in each segment. If a segment

y:

int | double

Examples

1) Noise supression using median filtering
fs = 1e3;
t =  1:1/fs:1;
s = sin(2*%pi*2*t)+ cos(2*%pi*5*t);
// Adding noise
x = s + 0.1*randn(size(s));
y = medfilt1(x);

See also

Authors


Report an issue
<< marcumq FOSSEE Signal Processing Toolbox mexihat >>