Mercurial > hg > ltpda
comparison m-toolbox/test/test_ao_cpsd_variance_montecarlo.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 % test_ao_cpsd_variance_montecarlo | |
2 % | |
3 % Tests that the standard deviation returned by ao.dy in one | |
4 % frequency bin is equivalent to the matlab's std taking | |
5 % considering all realisations | |
6 % | |
7 % M Nofrarias 22-07-09 | |
8 % | |
9 % $Id: test_ao_cpsd_variance_montecarlo.m,v 1.1 2009/08/11 14:20:11 miquel Exp $ | |
10 | |
11 | |
12 | |
13 clear | |
14 | |
15 % data | |
16 nsecs = 200; | |
17 fs = 10; | |
18 pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'randn(size(t))'); | |
19 | |
20 | |
21 % Make a filter | |
22 f1 = miir(plist('type', 'highpass', 'fc', 4, 'fs', fs)); | |
23 | |
24 % loop | |
25 for i = 1:100 | |
26 a1 = ao(pl); | |
27 a2 = filter(a1,plist('filter', f1)); | |
28 b(i) = cpsd(a1,a2,plist('Nfft',100,'order',-1)); | |
29 end | |
30 | |
31 %% mean | |
32 | |
33 clear rel | |
34 for i =1:len(b(1)) | |
35 mn(i) = [mean(b(:).y(i))]; % both means are equal | |
36 rel(:,i) = [std(b(:).y(i)) mean(b(:).dy(i))]/abs(mn(i)); | |
37 end | |
38 | |
39 figure | |
40 loglog(b(1).x,rel') | |
41 figure | |
42 loglog(b(1).x(:),abs(rel(2,:)-rel(1,:))) | |
43 | |
44 |