comparison m-toolbox/test/test_ao_lcpsd_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_lcpsd_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 Nfft = 1000;
26 win = specwin('Hanning', Nfft);
27 pl2 = plist('Lmin',200,'win',win,'Olap',-1)
28
29 % loop
30 for i = 1:100
31 a1 = ao(pl);
32 a2 = filter(a1,plist('filter', f1));
33 t1(i) = lcpsd(a1,a2,pl2);
34 end
35
36 %% mean
37 index = 6;
38
39 clear rel
40 for i =1:len(t1(1))
41 mn(i) = [mean(t1(:).y(i))]; % both means are equal
42 rel(:,i) = [std(t1(:).y(i)) mean(t1(:).dy(i))]/abs(mn(i));
43 end
44
45 k = find(t1(1).procinfo,'k')
46
47
48 figure
49 loglog(t1(1).x,rel')
50 figure
51 loglog(t1(1).x,abs(rel(2,:)-rel(1,:)))
52