comparison m-toolbox/test/test_ao_cohere.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/cohere functionality.
2 %
3 % M Hewitson 08-05-08
4 %
5 % $Id: test_ao_cohere.m,v 1.6 2009/04/07 17:45:22 ingo Exp $
6 %
7 function test_ao_cohere()
8
9 % Make test AOs
10
11 nsecs = 10;
12 fs = 1000;
13
14 pl = plist('nsecs', nsecs, 'fs', fs, 'tsfcn', 'sin(2*pi*7.433*t) + randn(size(t))');
15
16 a1 = ao(pl);
17 a2 = ao(pl);
18
19 % Filter one time-series
20 % Make a filter
21 pl = plist('type', 'bandpass', 'fs', 1000, 'order', 3, 'fc', [50 250]);
22 f2 = miir(pl);
23
24 % filter the input data
25 [a3, f2] = filter(a1,plist('filter', f2));
26
27 % make some cross-power
28 a4 = a3+a2;
29 a4.setName;
30
31 % Make cohere from a6 to a7
32 Nfft = 1000*2;
33 win = specwin('Hanning', Nfft);
34 pl = plist('Nfft', Nfft, 'Win', win, 'order', 2);
35 a8 = cohere(a4, a1, pl);
36
37
38 % Do with MATLAB
39 [cxy, f] = mscohere(a4.data.y, a1.data.y, win.win, Nfft/2, Nfft, a1.data.fs);
40 a9 = ao(fsdata(f, cxy));
41
42 % Plot
43 iplot(a8, a9, plist('YScales', 'lin', 'LineStyles', {'', '--'}))
44
45 end