Mercurial > hg > ltpda
comparison m-toolbox/test/test_ao_ltfe_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_ltfe_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_ltfe_variance_montecarlo.m,v 1.1 2009/08/11 14:20:10 miquel Exp $ | |
10 | |
11 % function test_ao_ltfe_variance_montecarlo() | |
12 | |
13 clear | |
14 | |
15 % data | |
16 nsecs = 200; | |
17 fs = 10; | |
18 pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*2*t) + randn(size(t))'); | |
19 | |
20 | |
21 % Make a filter | |
22 f1 = miir(plist('type', 'highpass', 'fc', 4, 'fs', fs)); | |
23 | |
24 % Window | |
25 pl2 = plist('Kdes',20,'win','Hanning','Order',-1) | |
26 | |
27 % loop | |
28 for i = 1:100 | |
29 a1 = ao(pl); | |
30 a2 = filter(a1,plist('filter', f1)); | |
31 t1(i) = ltfe(a1,a2,pl2); | |
32 end | |
33 | |
34 %% mean | |
35 index = 6; | |
36 | |
37 clear rel | |
38 for i =1:len(t1(1)) | |
39 mn(i) = [mean(t1(:).y(i))]; % both means are equal | |
40 rel(:,i) = [std(t1(:).y(i)) mean(t1(:).dy(i))]/abs(mn(i)); | |
41 end | |
42 | |
43 k = find(t1(1).procinfo,'k') | |
44 | |
45 figure | |
46 loglog(t1(1).x,rel') | |
47 figure | |
48 loglog(t1(1).x,100*abs(rel(2,:)-rel(1,:))) | |
49 ylabel('difference (%)') | |
50 |