Mercurial > hg > ltpda
comparison m-toolbox/test/compare_miir_mfir.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 % COMPARE_MIIR_MFIR tests the response of MIR and MFIR objects | |
2 % | |
3 % M Hueller 02-03-10 | |
4 % | |
5 % $Id: compare_miir_mfir.m,v 1.2 2010/03/02 16:20:51 mauro Exp $ | |
6 % | |
7 | |
8 | |
9 % Design filter to be a: | |
10 ftype = 'lowpass'; | |
11 | |
12 % Design for sampling frequency: | |
13 fs = 5; | |
14 | |
15 % Design with order: | |
16 order = 2; | |
17 | |
18 % Design for cutoff frequencies: | |
19 fc = [0.01 0.1]; | |
20 | |
21 % Build MIIR filter 1 | |
22 m1_miir = miir(plist('type', ftype, 'fs', fs, 'fc', fc(1), 'order', order)); | |
23 | |
24 % Build MIIR filter 2 | |
25 m2_miir = miir(plist('type', ftype, 'fs', fs, 'fc', fc(2), 'order', order)); | |
26 | |
27 % Build MFIR filter 1 | |
28 m1_mfir = mfir(plist('type', ftype, 'fs', fs, 'fc', fc(1), 'order', order)); | |
29 | |
30 % Build MFIR filter 2 | |
31 m2_mfir = mfir(plist('type', ftype, 'fs', fs, 'fc', fc(2), 'order', order)); | |
32 | |
33 % Response | |
34 nf = 1e4; | |
35 pl_resp = plist('f1', min(fc)/10, 'f2', fs/2, 'nf', nf); | |
36 | |
37 r_m1_miir = m1_miir.resp(pl_resp); | |
38 r_m2_miir = m2_miir.resp(pl_resp); | |
39 r_m1_mfir = m1_mfir.resp(pl_resp); | |
40 r_m2_mfir = m2_mfir.resp(pl_resp); | |
41 | |
42 % Plot | |
43 iplot(r_m1_miir, r_m2_miir); | |
44 iplot(r_m1_mfir, r_m2_mfir); | |
45 iplot(r_m1_miir, r_m1_mfir); |