Mercurial > hg > ltpda
comparison m-toolbox/test/test_ltpda_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 ltpda_cohere functionality. | |
2 % | |
3 % M Hewitson 13-02-07 | |
4 % | |
5 % $Id: test_ltpda_cohere.m,v 1.22 2009/04/07 17:45:22 ingo Exp $ | |
6 % | |
7 function test_ltpda_cohere() | |
8 | |
9 | |
10 % Make test AOs | |
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 a1 = ao(pl); | |
16 a2 = ao(pl); | |
17 | |
18 % Filter one time-series | |
19 | |
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 = 5.*a3+a2; | |
29 | |
30 % Make coherence | |
31 a8 = cohere(a4, a1, plist('Nfft', 2000)); | |
32 | |
33 % Plot results and history | |
34 | |
35 iplot(a8, plist('YScales', 'lin')); | |
36 plot(a8.hist); | |
37 | |
38 % Reproduce from history | |
39 a_out = rebuild(a8); | |
40 b = a_out; | |
41 | |
42 iplot(b) | |
43 plot(b.hist) | |
44 | |
45 end |