# hampel

Outlier removal using Hampel identifier

## Syntax

## Description

applies a Hampel
filter to the input vector `y`

= hampel(`x`

)`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 the function treats each column of
`x`

as an independent channel.

`hampel(___)`

with no output
arguments plots the filtered signal and annotates the outliers that
were removed.

## Examples

## Input Arguments

## Output Arguments

## More About

## References

[1] Liu, Hancong, Sirish Shah, and Wei Jiang. “On-line
outlier detection and data cleaning.” *Computers
and Chemical Engineering*. Vol. 28, March 2004, pp. 1635–1647.

[2] Suomela, Jukka. “Median Filtering Is Equivalent to Sorting.” 2014.

## Extended Capabilities

## Version History

**Introduced in R2015b**

## See Also

`medfilt1`

| `median`

| `filloutliers`

| `filter`

| `isoutlier`

| `mad`

(Statistics and Machine Learning Toolbox) | `movmad`

| `movmedian`

| `sgolayfilt`