%% Change in Mean
% Create a vector of noisy data, and compute the abrupt changes in the mean of the data.
%

A = [ones(1,5) 25*ones(1,5) 50*ones(1,5)] + rand(1,15);
TF = ischange(A)

%
% To compute the mean of the data in between change points, specify a second output argument.
%

[TF,S1] = ischange(A);
plot(A,'*')
hold on
stairs(S1)
legend('Data','Segment Mean','Location','NW')

% Copyright 2012 The MathWorks, Inc.