Mercurial > hg > ltpda
comparison m-toolbox/test/test_ao_noisegen2D_2.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 % A test script for ao/noisegen2D | |
2 % test ao/noisegen2D with input the model and output the filter | |
3 % | |
4 % DESCRIPTION: Run noisegen2D with test data and test procedure accuracy | |
5 % | |
6 % L. Ferraioli 10-11-08 | |
7 % | |
8 % $Id: test_ao_noisegen2D_2.m,v 1.1 2010/05/03 19:04:45 luigi Exp $ | |
9 % | |
10 | |
11 %% General use variables and vectors | |
12 | |
13 userdir = 'C:\Users\Luigi'; % You should set your own dir | |
14 | |
15 f = logspace(-6,log10(5),300); | |
16 fs = 10; | |
17 | |
18 Nt = fs*10000; | |
19 | |
20 | |
21 %% CSD Noise models | |
22 | |
23 fundir = fullfile(userdir,'ltp_data_analysis\MDCs\MDC1_UTN'); | |
24 cf = cd; | |
25 cd(fundir); | |
26 [TF,CSD] = mdc1_tf_models(plist('f',f,'fs',fs)); | |
27 cd(cf); | |
28 | |
29 | |
30 %% Plot Model Tfs | |
31 | |
32 iplot(TF(1,1),TF(1,2),TF(2,1),TF(2,2)) | |
33 | |
34 %% Plot Model CSD | |
35 | |
36 iplot(CSD(1,1),CSD(1,2),CSD(2,1),CSD(2,2)) | |
37 | |
38 %% Noise generation - 3 inputs | |
39 | |
40 pl = plist(... | |
41 'fs', fs, ... | |
42 'Iunits', '', ... | |
43 'Ounits', 'm', ... | |
44 'MaxIter', 80, ... | |
45 'PoleType', 2, ... | |
46 'MinOrder', 15, ... | |
47 'MaxOrder', 45, ... | |
48 'Weights', 3, ... | |
49 'FITTOL', 1e-3,... | |
50 'MSEVARTOL', 1e-1,... | |
51 'UseSym', 0,... | |
52 'Plot', false,... | |
53 'Disp', false); | |
54 | |
55 fil = noisegen2D(CSD(1,1),CSD(1,2),CSD(2,2), pl); | |
56 | |
57 %% filtering data | |
58 | |
59 a1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', 10, 'nsecs', 1e5)); | |
60 a2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', 10, 'nsecs', 1e5)); | |
61 | |
62 a = matrix(a1,a2,plist('shape',[2 1])); | |
63 | |
64 b = filter(a,fil); | |
65 | |
66 %% Checking results and starting data | |
67 | |
68 iplot(b.objs) | |
69 | |
70 %% Make psd | |
71 | |
72 plpsd = plist('navs',8,'order',1,'olap',50); | |
73 bxx1 = b.objs(1).psd(plpsd); | |
74 bxx2 = b.objs(2).psd(plpsd); | |
75 | |
76 iplot(bxx1,CSD(1,1),bxx2,CSD(2,2)) | |
77 | |
78 %% Noise generation - 4 inputs | |
79 | |
80 pl = plist(... | |
81 'fs', fs, ... | |
82 'Iunits', '', ... | |
83 'Ounits', 'm', ... | |
84 'MaxIter', 80, ... | |
85 'PoleType', 2, ... | |
86 'MinOrder', 15, ... | |
87 'MaxOrder', 45, ... | |
88 'Weights', 3, ... | |
89 'FITTOL', 1e-3,... | |
90 'MSEVARTOL', 1e-1,... | |
91 'UseSym', 0,... | |
92 'Plot', false,... | |
93 'Disp', false); | |
94 | |
95 fil = noisegen2D(CSD(1,1),CSD(1,2),CSD(2,1),CSD(2,2), pl); | |
96 | |
97 %% filtering data | |
98 | |
99 a1 = ao(plist('tsfcn', 'randn(size(t))', 'fs', 10, 'nsecs', 1e5)); | |
100 a2 = ao(plist('tsfcn', 'randn(size(t))', 'fs', 10, 'nsecs', 1e5)); | |
101 | |
102 a = matrix(a1,a2,plist('shape',[2 1])); | |
103 | |
104 b = filter(a,fil); | |
105 | |
106 %% Checking results and starting data | |
107 | |
108 iplot(b.objs) | |
109 | |
110 %% Make psd | |
111 | |
112 plpsd = plist('navs',8,'order',1,'olap',50); | |
113 bxx1 = b.objs(1).psd(plpsd); | |
114 bxx2 = b.objs(2).psd(plpsd); | |
115 | |
116 iplot(bxx1,CSD(1,1),bxx2,CSD(2,2)) |