Mercurial > hg > ltpda
comparison m-toolbox/test/test_ltpda_lcpsd.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_lcpsd() | |
2 | |
3 % Test ltpda_lcpsd functionality. | |
4 % | |
5 % M Hewitson 13-02-07 | |
6 % | |
7 % $Id: test_ltpda_lcpsd.m,v 1.5 2008/06/13 13:51:46 hewitson Exp $ | |
8 % | |
9 | |
10 %% Make test AOs | |
11 | |
12 nsecs = 10000; | |
13 fs = 10; | |
14 | |
15 pl = plist(); | |
16 pl = append(pl, param('nsecs', nsecs)); | |
17 pl = append(pl, param('fs', fs)); | |
18 pl = append(pl, param('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(pl, param('fs', fs)); | |
29 pl = append(pl, param('order', 4)); | |
30 pl = append(pl, param('fc', [0.05 0.2])); | |
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 | |
38 a4 = a3+a2; | |
39 | |
40 | |
41 %% Make CPSD from a6 to a7 | |
42 | |
43 pl = plist(); | |
44 pl = append(pl, param('Kdes', 100)); | |
45 pl = append(pl, param('Kmin', 2)); | |
46 pl = append(pl, param('Jdes', 1000)); | |
47 pl = append(pl, param('Order', 1)); | |
48 pl = append(pl, param('Win', specwin('Hanning', 10))); | |
49 | |
50 a8 = lcpsd(a1, a4, pl); | |
51 a9 = lcpsd(a1, a4); | |
52 | |
53 | |
54 %% Plot results and history | |
55 | |
56 iplot(a9(1,2), a8(1,2)); | |
57 plot(a8(1,2).hist); | |
58 | |
59 | |
60 %% Reproduce from history | |
61 | |
62 % Write an m-file from AO | |
63 ao2m(a8(1,2), 'test.m'); | |
64 | |
65 % now run it | |
66 clear all; | |
67 a_out = test | |
68 | |
69 iplot(a_out(1,2)) | |
70 plot(a_out(1,2).hist) |