You are here : matlabSignal Processinghampel

hampel() - Signal Processing

y = hampel(x) applies a Hampel filter to the input vector, x, to detect and remove outliers.

For each sample of x, the function computes the median of a window composed of the sample and its six surrounding samples, three per side.

It also estimates the standard deviation of each sample about its window median using the median absolute deviation.

If a sample differs from the median by more than three standard deviations, it is replaced with the median.

If x is a matrix, then hampel treats each column of x as an independent channel.


Syntax

    y = hampel(x)
    example
    y = hampel(x,k)
    y = hampel(x,k,nsigma)
    example

    [y,j] = hampel(___)
    example
    [y,j,xmedian,xsigma] = hampel(___)
    example

    hampel(___)


Example

%Generate 100 samples of a sinusoidal signal. Replace the sixth and twentieth samples with spikes.
x = sin(2*pi*(0:99)/100);
x(6) = 2;
x(20) = -2;
%Use hampel to locate every sample that differs by more than three standard deviations from the local median. The measurement window is composed of the sample and its six surrounding samples, three per side.
[y,i,xmedian,xsigma] = hampel(x);


Output / Return Value


Limitations


Alternatives / See Also


Reference

http://in.mathworks.com/help/signal/ref/hampel.html