comparison m-toolbox/test/test_pzmodel_class.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 % Test script for pzmodel class.
2 %
3 % M Hewitson 03-04-07
4 %
5 % $Id: test_pzmodel_class.m,v 1.16 2009/02/02 15:20:37 hewitson Exp $
6 %
7 function test_pzmodel_class()
8
9 % direct
10 poles = [pz(1,2) pz(40)];
11 zeros = [pz(10,3) pz(100)];
12 pzm = pzmodel(10, poles, zeros)
13 resp(pzm)
14
15 % From plist
16 pl = plist('name', 'test model', 'gain', 10, 'poles', [pz(1,2) pz(40)], 'zeros', [pz(10,3) pz(100)]);
17 pzm = pzmodel(pl)
18
19 string(pzm)
20 eval(ans)
21
22 rpl = plist('f1', 0.1, 'f2', 1000, 'nf', 10000);
23
24 pzm = pzmodel(plist('name', 'pzmodel', ...
25 'gain', 1, ...
26 'poles', pz(plist('f', 1, 'q', 3)), ...
27 'zeros', pz(3), ...
28 'fs', 2000))
29 a = resp(pzm, rpl)
30 iplot(a)
31
32 % Make IIR filter
33
34 pzm = pzmodel(1, pz(1), pz(10))
35
36 filt = miir(plist('pzmodel', pzm))
37 newfilt = redesign(filt, 2000);
38
39 filtresp = resp(filt);
40 newfiltresp = resp(newfilt, plist('f', filtresp.data.x));
41
42 % iplot(filtresp, newfiltresp)
43 plot(filtresp.hist)
44
45
46 % Reproduce from history
47 a_out = rebuild(filtresp);
48
49 iplot(a_out)
50 plot(a_out.hist)
51
52 end