# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

# wvarchg

Find variance change points

## Syntax

```[PTS_OPT,KOPT,T_EST] = wvarchg(Y,K,D) ```

## Description

`[PTS_OPT,KOPT,T_EST] = wvarchg(Y,K,D)` computes estimated variance change points for the signal `Y` for j change points, with j = 0, 1, 2, ... , `K`.

Integer `D` is the minimum delay between two change points.

Integer `KOPT` is the proposed number of change points (0 ≤ `KOPT``K`). The vector `PTS_OPT` contains the corresponding change points.

For `1`` k `` K`, `T_EST(k+1,1:k)` contains the `k` instants of the variance change points and then, if `KOPT > 0`, `PTS_OPT = T_EST(KOPT+1,1:KOPT)` else ```PTS_OPT = []```.

`K` and `D` must be integers such that 1 < `K` << length(`Y`) and 1 ≤ `D` << length(`Y`).

The signal `Y` should be zero mean.

`wvarchg(Y,K)` is equivalent to `wvarchg(Y,K,10)`.

`wvarchg(Y)` is equivalent to `wvarchg(Y,6,10)`.

## Examples

collapse all

Add two variance change points to the blocks signal. Detect the variance change points using `wvarchg`.

Load the blocks signal. Add white noise with two variance change points located at index 180 and 600.

```x = wnoise(1,10); rng default; bb = 1.5*randn(1,length(x)); cp1 = 180; cp2 = 600; x = x + [bb(1:cp1),bb(cp1+1:cp2)/4,bb(cp2+1:end)];```

Obtain the level-1 wavelet coefficients. Replace the top 2% of values with the mean value of the wavelet coefficients to remove all signal.

```wname = 'db3'; lev = 1; [c,l] = wavedec(x,lev,wname); det = wrcoef('d',c,l,wname,1); y = sort(abs(det)); v2p100 = y(fix(length(y)*0.98)); ind = find(abs(det)>v2p100); det(ind) = mean(det);```

Estimate the variance change points using the wavelet coefficients.

```[pts_Opt,kopt,t_est] = wvarchg(det,5); sprintf('The estimated change points are %d and %d\n',pts_Opt)```
```ans = 'The estimated change points are 181 and 601 ' ```

## References

Lavielle, M. (1999), “Detection of multiple changes in a sequence of dependent variables,” Stoch. Proc. and their Applications, 83, 2, pp. 79–102.