Mercurial > hg > ltpda
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % | |
2 % A test script for spcorr | |
3 % | |
4 % L Ferraioli 30-06-2011 | |
5 % | |
6 % $Id: test_ao_spcorr.m,v 1.1 2011/07/06 15:06:42 luigi Exp $ | |
7 % | |
8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
9 %% useful vars | |
10 nsecs = 1000; | |
11 fs = 1; | |
12 | |
13 %% test behaviour | |
14 | |
15 alp = 0.05; | |
16 plcorr = plist('ALPHA',alp); | |
17 | |
18 a1 = ao.randn(nsecs,fs); | |
19 a2 = ao.randn(nsecs,fs); | |
20 a3 = ao.randn(nsecs,fs); | |
21 a4 = ao.randn(nsecs,fs); | |
22 | |
23 b = spcorr(a1,a2,a3,a4,plcorr); | |
24 | |
25 %% test statistic hypotheis test fairness | |
26 | |
27 Nmc = 1000; | |
28 | |
29 alp = 0.05; | |
30 plcorr = plist('ALPHA',alp); | |
31 | |
32 TestRes = zeros(Nmc,1); | |
33 % run Monte Carlo | |
34 for ii=1:Nmc | |
35 a1 = ao.randn(nsecs,fs); | |
36 a2 = ao.randn(nsecs,fs); | |
37 | |
38 b = spcorr(a1,a2,plcorr); | |
39 % get procinfo | |
40 bp = b.procinfo; | |
41 % get test result | |
42 tr = find(bp,'TestRes'); | |
43 TestRes(ii) = double(tr); | |
44 | |
45 end | |
46 | |
47 % the sum of the elements of TestRes should be a number near Nmc*alp | |
48 sum(TestRes) | |
49 Nmc*alp |