Mercurial > hg > ltpda
comparison m-toolbox/test/test_ltpda_lcohere.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 function test_ltpda_lcohere() | |
2 | |
3 % Test ltpda_lcohere functionality. | |
4 % | |
5 % M Hewitson 13-02-07 | |
6 % | |
7 % $Id: test_ltpda_lcohere.m,v 1.6 2008/07/20 19:55:43 hewitson Exp $ | |
8 % | |
9 | |
10 %% Make test AOs | |
11 | |
12 nsecs = 100000; | |
13 fs = 10; | |
14 | |
15 pl = plist(); | |
16 pl.append('nsecs', nsecs); | |
17 pl.append('fs', fs); | |
18 pl.append('tsfcn', 'randn(size(t))'); | |
19 | |
20 a1 = ao(pl); | |
21 a2 = ao(pl); | |
22 | |
23 %% Filter one time-series | |
24 | |
25 | |
26 % Make a filter | |
27 pl = plist(param('type', 'bandpass')); | |
28 pl.append('fs', fs); | |
29 pl.append('order', 4); | |
30 pl.append('fc', [0.03 0.1]); | |
31 f2 = miir(pl); | |
32 | |
33 % filter the input data | |
34 [a3, f2] = filter(a1,plist(param('filter', f2))); | |
35 | |
36 %% make some cross-power | |
37 a4 = a1+a3; | |
38 a5 = a2+a3; | |
39 | |
40 %% Make Coherence from a6 to a7 | |
41 | |
42 pl = plist(); | |
43 pl.append('Kdes', 100); | |
44 pl.append('Kmin', 2); | |
45 pl.append('Jdes', 1000); | |
46 pl.append('Order', 0); | |
47 pl.append('Lmin', 0); | |
48 pl.append('Win', specwin('Hanning', 10)); | |
49 | |
50 a8 = lcohere(a1, a5, pl); | |
51 a9 = cohere(a1, a5, plist('Nfft', 10000, 'win', specwin('Hanning', 10))); | |
52 | |
53 | |
54 %% Plot results and history | |
55 | |
56 iplot(a9(1,2), a8(1,2)); | |
57 | |
58 plot(a8(1,2).hist); | |
59 | |
60 return | |
61 | |
62 %% Reproduce from history | |
63 | |
64 % Write an m-file from AO | |
65 ao2m(a8(1,2), 'test.m'); | |
66 | |
67 % now run it | |
68 clear all; | |
69 a_out = test; | |
70 | |
71 iplot(a_out(1,2)) | |
72 | |
73 plot(a_out(1,2).hist) |