view m-toolbox/test/test_ao_spcorr.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +0100
parents f0afece42f48
children
line wrap: on
line source

% 
% 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