diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/test/compare_miir_mfir.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,45 @@
+% COMPARE_MIIR_MFIR tests the response of MIR and MFIR objects
+%
+% M Hueller 02-03-10
+%
+% $Id: compare_miir_mfir.m,v 1.2 2010/03/02 16:20:51 mauro Exp $
+%
+
+
+% Design filter to be a:
+ftype = 'lowpass';
+
+% Design for sampling frequency:
+fs = 5;
+
+% Design with order:
+order = 2;
+
+% Design for cutoff frequencies:
+fc = [0.01 0.1];
+
+% Build MIIR filter 1
+m1_miir = miir(plist('type', ftype, 'fs', fs, 'fc', fc(1), 'order', order));
+
+% Build MIIR filter 2
+m2_miir = miir(plist('type', ftype, 'fs', fs, 'fc', fc(2), 'order', order));
+
+% Build MFIR filter 1
+m1_mfir = mfir(plist('type', ftype, 'fs', fs, 'fc', fc(1), 'order', order));
+
+% Build MFIR filter 2
+m2_mfir = mfir(plist('type', ftype, 'fs', fs, 'fc', fc(2), 'order', order));
+
+% Response
+nf = 1e4;
+pl_resp = plist('f1', min(fc)/10, 'f2', fs/2, 'nf', nf);
+
+r_m1_miir = m1_miir.resp(pl_resp);
+r_m2_miir = m2_miir.resp(pl_resp);
+r_m1_mfir = m1_mfir.resp(pl_resp);
+r_m2_mfir = m2_mfir.resp(pl_resp);
+
+% Plot
+iplot(r_m1_miir, r_m2_miir);
+iplot(r_m1_mfir, r_m2_mfir);
+iplot(r_m1_miir, r_m1_mfir);
\ No newline at end of file