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