Home > NoiseTools > TEST > test_nt_split2.m

test_nt_split2

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 clear
0002 
0003 N=10000;
0004 
0005 % data is concatenation of segments each of dimensionality (rank) 5
0006 a=nt_normcol(randn(N,5)*randn(5,10));
0007 b=nt_normcol(randn(N,5)*randn(5,10));
0008 c=nt_normcol(randn(N,5)*randn(5,10));
0009 
0010 % contains steps in mean, variance, covariance:
0011 x=[a+1;a;2*a;a;b;c];
0012 
0013 % apply nt_split with codes 1,2,3:
0014 
0015 % code 1: minimize variance (finds steps in mean)
0016 figure(1); clf
0017 DEPTH=1;    % --> 1 split point
0018 nt_split(x,1,DEPTH);
0019 
0020 % code 2: minimize change in variance/covariance
0021 figure(2); clf
0022 DEPTH=2;    % --> 3 split points
0023 nt_split(x,2,DEPTH);
0024 
0025 % code 3: minimize change in covariance "shape:
0026 figure(3); clf
0027 DEPTH=2;    % --> 3 split points
0028 nt_split(x,3,DEPTH);
0029 
0030 TOL=10^-6;
0031 disp(['rank of whole data: ', num2str(rank(x,TOL))]);        
0032 idx=nt_split(x,3,DEPTH);
0033 disp(['rank of intervals: ', ...
0034     num2str([rank(x(1:idx(1),:),TOL), ...
0035     rank(x(idx(1)+1:idx(2),:),TOL), ...
0036     rank(x(idx(2)+1:idx(3),:),TOL), ...
0037     rank(x(idx(3)+1:end,:),TOL)])]);

Generated on Fri 23-May-2014 19:34:17 by m2html © 2005