Main Content

Outlier removal using Hampel identifier

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 `hampel`

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.

[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.

`filloutliers`

| `filter`

| `isoutlier`

| `medfilt1`

| `median`

| `movmad`

| `movmedian`

| `sgolayfilt`

| `mad`

(Statistics and Machine Learning Toolbox)