ischange

Detects abrupt changes in a data series.

Category: Data Import and Analysis > Preprocessing Data

Syntax

TF = ischange(A)

Marks the points where the mean of A changes abruptly.

[TF, S1] = ischange(A)

Also returns the piecewise constant level estimated at every point.

Description

The data are split into segments so that the points within each segment are close to a constant. ischange flags the index where a new segment starts, which is a quick way to find level shifts, step changes and regime switches. The first element is never marked.

The number of changes found depends on the noise: very noisy data may produce more flags.

Input arguments

A
Numeric vector (or matrix, analyzed by columns).

Output arguments

TF
Logical array, true at the first point of each new segment.
S1
Segment mean assigned to each point.

Example

A step in a series

x = [1 1 1 5 5 5];
[tf, s] = ischange(x)
find(tf)
Output
tf = 1×6 logical array

   0   0   0   1   0   0
s = 1×6

     1     1     1     5     5     5
ans = 4

See also

islocalmax isoutlier diff