view m-toolbox/test/compare_miir_mfir.m @ 48:16aa66670d74 database-connection-manager

Fix LTPDA Preferences tooltip
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:27 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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);