www.gusucode.com > signal 案例源码程序 matlab代码 > signal/ChangeOfMeanVarianceAndSlopeExample.m

    %% Change of Mean, RMS Level, Standard Deviation, and Slope
% Create a signal that consists of two sinusoids with varying amplitude and
% a linear trend.

%%

vc = sin(2*pi*(0:201)/17).*sin(2*pi*(0:201)/19).* ...
    [sqrt(0:0.01:1) (1:-0.01:0).^2]+(0:201)/401;

%%
% Find the points where the signal mean changes most significantly. The
% |'Statistic'| name-value pair is optional in this case. Specify a minimum
% residual error improvement of 1.

findchangepts(vc,'Statistic','mean','MinThreshold',1)

%%
% Repeat the computation, but now find the points where the
% root-mean-square level of the signal changes the most. Specify a minimum
% residual error improvement of 6.

findchangepts(vc,'Statistic','rms','MinThreshold',6)

%%
% Repeat the computation, but now find the points where the standard
% deviation of the signal changes most significantly. Specify a minimum
% residual error improvement of 10.

findchangepts(vc,'Statistic','std','MinThreshold',10)

%%
% Find the points where the mean and the slope of the signal change most
% abruptly. Specify a minimum improvement of 0.6.

findchangepts(vc,'Statistic','linear','MinThreshold',0.6)