Home > NoiseTools > TEST > test_nt_split.m

test_nt_split

PURPOSE ^

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 clear
0002 N=10000;
0003 
0004 % single channel, step
0005 x=[randn(N,1)+1; randn(N,1)-1]; 
0006 
0007 figure(1); clf;
0008 subplot 411
0009 plot(x); title('step (with noise)');
0010 subplot 423
0011 [idx,score_vector,score]=nt_split(x); 
0012 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0013 plot(score_vector); title('split on mean')
0014 subplot 424
0015 [idx,score_vector,score]=nt_split(x.^2); 
0016 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0017 plot(score_vector); title('split on power')
0018 
0019 % single channel, step in power
0020 x=[randn(N,1); 2*randn(N,1)];  
0021 subplot 413
0022 plot(x); title('step in power of Gaussian noise')
0023 subplot 427
0024 [idx,score_vector,score]=nt_split(x); 
0025 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0026 plot(score_vector); title('split on mean')
0027 subplot 428
0028 [idx,score_vector,score]=nt_split(x.^2); 
0029 plot(score_vector); title('split on power')
0030 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0031 
0032 
0033 % 10 channels
0034 a=nt_normcol(randn(N,5)*randn(5,10));
0035 b=nt_normcol(randn(N,5)*randn(5,10));
0036 
0037 % change in covariance
0038 x=[a;b];  
0039 figure(2); clf
0040 subplot 311
0041 plot(x); title('10 channel noise, change in covariance');
0042 subplot 323
0043 [idx,score_vector,score]=nt_split(x.^2); 
0044 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0045 plot(score_vector); title('split on power')
0046 subplot 324
0047 [idx,score_vector,score]=nt_split(nt_xprod(x, 'lower')); 
0048 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0049 plot(score_vector); title('split on cov (lower)')
0050 subplot 325
0051 [idx,score_vector,score]=nt_split(nt_xprod(x, 'nodiag')); 
0052 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0053 plot(score_vector); title('split on cov (no diag)')
0054 subplot 326
0055 [idx,score_vector,score]=nt_split(nt_normrow(nt_xprod(x,'lower'))); 
0056 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0057 plot(score_vector); title('split on cov (lower, normrow)')
0058 
0059 % change in covariance, change in power
0060 x=[a;b;2*b];  
0061 figure(3); clf
0062 subplot 311
0063 plot(x); title('10 channel noise, change in covariance, then power');
0064 subplot 323
0065 [idx,score_vector,score]=nt_split(x.^2); 
0066 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0067 plot(score_vector); title('split on power')
0068 subplot 324
0069 [idx,score_vector,score]=nt_split(nt_xprod(x, 'lower')); 
0070 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0071 plot(score_vector); title('split on cov (lower)')
0072 subplot 325
0073 [idx,score_vector,score]=nt_split(nt_xprod(x, 'nodiag')); 
0074 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0075 plot(score_vector); title('split on cov (nodiag)')
0076 subplot 326
0077 [idx,score_vector,score]=nt_split(nt_normrow(nt_xprod(x,'lower'))); 
0078 disp([num2str(idx), 'score: ',num2str(score,'%.03f')]);   
0079 plot(score_vector); title('split on cov (lower, normrow)')
0080

Generated on Sat 29-Apr-2023 17:15:46 by m2html © 2005