[chgpts,kopt,est] = wvarchg(Y)
computes estimated variation change points for the signal Y for
six change points, where the minimum delay between two change points is 10.

[___] = wvarchg(Y,K)
computes estimated variation change points for j change points,
where j = 0, 1, 2, …, K, and the minimum delay between two change
points is 10.

[___] = wvarchg(Y,K,D)
computes estimated variation change points where the minimum delay between two
change points is D.

For reproducibility, set the random seed to the default value. Load the blocks wavelet test signal. Add white noise with two variance change points located at indices 180 and 600. Plot the noise and the noisy signal.

Use the db3 wavelet and do a level-1 wavelet decomposition of the signal. Reconstruct the detail coefficients. Replace the top 2% of values with the mean value of the wavelet coefficients to remove most of the signal. Plot the values.

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);
figure
plot(det)
title('Reconstructed Details')

Estimate the variance change points using the wavelet coefficients.

[pts_Opt,kopt,t_est] = wvarchg(det,5);
fprintf('The estimated change points are %d and %d.',pts_Opt)

Estimated variance change points, returned as a vector.
chgpts is the empty vector [] when
no change points are found.

kopt — Proposed number of change points nonnegative integer

Proposed number of change points, returned as a nonnegative integer in the
interval [0, k].

est — Instants of the variation change points real-valued matrix

Instants of the variation change points, returned as a real-valued matrix.
For 1 ≤ k ≤ K, est(k+1,1:k) contains
the k instants of the variance change points. If
kopt > 0, then chgpts =
est(kopt+1,1:kopt), else chgpts =
[].

References

[1] Lavielle, M. "Detection of
multiple changes in a sequence of dependent variables." Stochastic Processes
and their Applications. Vol. 83, Number 1, 1999, pp.
79–102.

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.