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 M-FILE INFO: Get information about this methods by calling >> pzmodel.getInfo('tomiir') Get information about a specified set-plist by calling: >> pzmodel.getInfo('tomiir', 'None') VERSION: $Id: tomiir.m,v 1.8 2008/09/04 15:29:31 ingo Exp $ HISTORY: 03-04-2007 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % TOMIIR converts a pzmodel to an IIR filter using a bilinear transform. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: TOMIIR converts a pzmodel to an IIR filter using a bilinear 0005 % transform. 0006 % 0007 % CALL: f = tomiir(pzm, fs); % construct for this sample frequency fs 0008 % f = tomiir(pzm, pl); % construct from plist 0009 % 0010 % PARAMETERS: 'fs' - sample frequency 0011 % 0012 % M-FILE INFO: Get information about this methods by calling 0013 % >> pzmodel.getInfo('tomiir') 0014 % 0015 % Get information about a specified set-plist by calling: 0016 % >> pzmodel.getInfo('tomiir', 'None') 0017 % 0018 % VERSION: $Id: tomiir.m,v 1.8 2008/09/04 15:29:31 ingo Exp $ 0019 % 0020 % HISTORY: 03-04-2007 M Hewitson 0021 % Creation 0022 % 0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 0025 function f = tomiir(varargin) 0026 0027 %%% Check if this is a call for parameters 0028 if utils.helper.isinfocall(varargin{:}) 0029 f = getInfo(varargin{3}); 0030 return 0031 end 0032 0033 pzm = varargin{1}; 0034 if ~isa(pzm, 'pzmodel') 0035 error('### first argument should be a pzmodel.'); 0036 end 0037 0038 if nargin < 1 0039 error('### incorrect number of inputs.'); 0040 end 0041 0042 % Get fs 0043 if nargin == 1 0044 warning('!!! Using default sample rate of 1Hz to design filter.'); 0045 fs = 1; 0046 else 0047 if isa(varargin{2}, 'plist') 0048 pl = varargin{2}; 0049 fs = find(pl, 'fs'); 0050 if isempty(fs) 0051 error('### unknown parameter list.'); 0052 end 0053 else 0054 fs = varargin{2}; 0055 end 0056 end 0057 0058 % get a and b coefficients 0059 [a,b] = pzm2ab(pzm, fs); 0060 0061 % make MIIR filter 0062 f = miir(a,b,fs); 0063 end 0064 0065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0066 % Local Functions % 0067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0068 0069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0070 % 0071 % FUNCTION: getInfo 0072 % 0073 % DESCRIPTION: Get Info Object 0074 % 0075 % HISTORY: 11-07-07 M Hewitson 0076 % Creation. 0077 % 0078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0079 0080 function ii = getInfo(varargin) 0081 if nargin == 1 && strcmpi(varargin{1}, 'None') 0082 sets = {}; 0083 pl = []; 0084 else 0085 sets = {'Default'}; 0086 pl = getDefaultPlist; 0087 end 0088 % Build info object 0089 ii = minfo(mfilename, '', '', utils.const.categories.op, '$Id: tomiir.m,v 1.8 2008/09/04 15:29:31 ingo Exp $', sets, pl); 0090 end 0091 0092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0093 % 0094 % FUNCTION: getDefaultPlist 0095 % 0096 % DESCRIPTION: Get Default Plist 0097 % 0098 % HISTORY: 11-07-07 M Hewitson 0099 % Creation. 0100 % 0101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0102 0103 function plo = getDefaultPlist() 0104 plo = plist(); 0105 end 0106