diff m-toolbox/test/test_ao_spcorr.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/test/test_ao_spcorr.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,49 @@
+% 
+% A test script for spcorr
+% 
+% L Ferraioli 30-06-2011
+%
+% $Id: test_ao_spcorr.m,v 1.1 2011/07/06 15:06:42 luigi Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% useful vars
+nsecs = 1000;
+fs = 1;
+
+%% test behaviour
+
+alp = 0.05;
+plcorr = plist('ALPHA',alp);
+
+a1 = ao.randn(nsecs,fs);
+a2 = ao.randn(nsecs,fs);
+a3 = ao.randn(nsecs,fs);
+a4 = ao.randn(nsecs,fs);
+
+b = spcorr(a1,a2,a3,a4,plcorr);
+
+%% test statistic hypotheis test fairness
+
+Nmc = 1000;
+
+alp = 0.05;
+plcorr = plist('ALPHA',alp);
+
+TestRes = zeros(Nmc,1);
+% run Monte Carlo
+for ii=1:Nmc
+  a1 = ao.randn(nsecs,fs);
+  a2 = ao.randn(nsecs,fs);
+  
+  b = spcorr(a1,a2,plcorr);
+  % get procinfo
+  bp = b.procinfo;
+  % get test result
+  tr = find(bp,'TestRes');
+  TestRes(ii) = double(tr);
+  
+end
+
+% the sum of the elements of TestRes should be a number near Nmc*alp
+sum(TestRes)
+Nmc*alp
\ No newline at end of file