0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 clear all;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %% Char param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 xmlfile = 'char.xml';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 p = param('a', 'val');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 save(p, xmlfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 q = param(xmlfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 if p ~= q
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 error('param char test failed')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 %% Numeric param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 xmlfile = 'numeric.xml';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 p = param('a', 2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 save(p, xmlfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 q = param(xmlfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 if p ~= q
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 error('param numeric test failed')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 %% Specwin param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 xmlfile = 'specwin.xml';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 p = param('a', specwin('Hanning', 20));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 save(p, xmlfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 q = param(xmlfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 if p ~= q
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 error('param specwin test failed')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 %% Time param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 xmlfile = 'time.xml';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 p = param('a', time());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 save(p, xmlfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 q = param(xmlfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 if p ~= q
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 error('param time test failed')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 %% MIIR param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 xmlfile = 'miir.xml';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 pl_mii = plist('type', 'bandpass', 'fs', 1000, 'fc', [50 100], 'order', 3);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 p = param('a', miir(pl_mii));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 save(p, xmlfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 q = param(xmlfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 if p ~= q(1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 error('param miir test failed')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 %% MFIR param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 xmlfile = 'mfir.xml';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 pl_mir = plist('type', 'lowpass', 'Win', specwin('Kaiser', 10, 150), 'fs', 100, 'fc', 20);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 p = param('a', mfir(pl_mir));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 save(p, xmlfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 q = param(xmlfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 if p ~= q(1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 error('param mfir test failed')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 %% pole param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 xmlfile = 'pole.xml';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 p = param('a', pz(1));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 save(p, xmlfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 q = param(xmlfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 if p ~= q
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 error('param pole test failed')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 %% zero param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 xmlfile = 'zero.xml';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 p = param('a', pz(1,10));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 save(p, xmlfile)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 q = param(xmlfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 if p ~= q
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 error('param zero test failed')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 %% pzmodel param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 xmlfile = 'pzmodel.xml';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 pzm = pzmodel(1, [pz(1) pz(2,10)], pz(4.3));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 p = param('a', pzm);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 save(p, xmlfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 q = param(xmlfile);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 if p ~= q
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 error('param pzmodel test failed')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 end
|