


TOMIIR converts a pzmodel to an IIR filter using a bilinear transform.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: TOMIIR converts a pzmodel to an IIR filter using a bilinear
transform.
CALL: f = tomiir(pzm, fs); % construct for this sample frequency fs
f = tomiir(pzm, pl); % construct from plist
PARAMETERS: 'fs' - sample frequency
VERSION: $Id: tomiir.m,v 1.5 2008/01/08 14:57:07 ingo Exp $
HISTORY: 03-04-2007 M Hewitson
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0001 function f = tomiir(varargin) 0002 % TOMIIR converts a pzmodel to an IIR filter using a bilinear transform. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: TOMIIR converts a pzmodel to an IIR filter using a bilinear 0007 % transform. 0008 % 0009 % CALL: f = tomiir(pzm, fs); % construct for this sample frequency fs 0010 % f = tomiir(pzm, pl); % construct from plist 0011 % 0012 % PARAMETERS: 'fs' - sample frequency 0013 % 0014 % VERSION: $Id: tomiir.m,v 1.5 2008/01/08 14:57:07 ingo Exp $ 0015 % 0016 % HISTORY: 03-04-2007 M Hewitson 0017 % Creation 0018 % 0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 0021 VERSION = '$Id: tomiir.m,v 1.5 2008/01/08 14:57:07 ingo Exp $'; 0022 0023 % Check if this is a call for parameters 0024 if nargin == 2 0025 if isa(varargin{1}, 'pzmodel') && ischar(varargin{2}) 0026 in = char(varargin{2}); 0027 if strcmp(in, 'Params') 0028 f = plist; 0029 return 0030 elseif strcmp(in, 'Version') 0031 f = VERSION; 0032 return 0033 end 0034 end 0035 end 0036 0037 pzm = varargin{1}; 0038 if ~isa(pzm, 'pzmodel') 0039 error('### first argument should be a pzmodel.'); 0040 end 0041 0042 if nargin < 1 0043 error('### incorrect number of inputs.'); 0044 end 0045 0046 % Get fs 0047 if nargin == 1 0048 warning('!!! Using default sample rate of 1Hz to design filter.'); 0049 fs = 1; 0050 else 0051 if isa(varargin{2}, 'plist') 0052 pl = varargin{2}; 0053 fs = find(pl, 'fs'); 0054 if isempty(fs) 0055 error('### unknown parameter list.'); 0056 end 0057 else 0058 fs = varargin{2}; 0059 end 0060 end 0061 0062 % get a and b coefficients 0063 [a,b] = pzm2ab(pzm, fs); 0064 0065 % make MIIR filter 0066 f = miir(a,b,fs); 0067 0068 0069 % END