Home > classes > @pzmodel > tomiir.m

tomiir

PURPOSE ^

TOMIIR converts a pzmodel to an IIR filter using a bilinear transform.

SYNOPSIS ^

function f = tomiir(varargin)

DESCRIPTION ^

 TOMIIR converts a pzmodel to an IIR filter using a bilinear transform.
 
 usage: f = tomiir(pzm, fs); % construct for this sample frequency fs
        f = tomiir(pzm, pl); % construct from plist
 
 Parameters:
   'fs'  - sample frequency
 
 M Hewitson 03-04-07

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function f = tomiir(varargin)
0002 
0003 % TOMIIR converts a pzmodel to an IIR filter using a bilinear transform.
0004 %
0005 % usage: f = tomiir(pzm, fs); % construct for this sample frequency fs
0006 %        f = tomiir(pzm, pl); % construct from plist
0007 %
0008 % Parameters:
0009 %   'fs'  - sample frequency
0010 %
0011 % M Hewitson 03-04-07
0012 %
0013 %
0014 
0015 ALGONAME = mfilename;
0016 VERSION  = '$Id: tomiir.html,v 1.1 2007/06/08 14:15:07 hewitson Exp $';
0017 
0018 pzm = varargin{1};
0019 if ~isa(pzm, 'pzmodel')
0020   error('### first argument should be a pzmodel.');
0021 end
0022 
0023 if nargin < 1
0024   error('### incorrect number of inputs.');
0025 end
0026 
0027 % Get fs
0028 if nargin == 1
0029   warning('!!! Using default sample rate of 1Hz to design filter.');
0030   fs = 1;
0031 else
0032   if isa(varargin{2}, 'plist')
0033     pl = varargin{2};
0034     fs = find(pl, 'fs');
0035     if isempty(fs)
0036       error('### unknown parameter list.');
0037     end
0038   else
0039     fs = varargin{2};
0040   end
0041 end
0042 
0043 % get a and b coefficients
0044 [a,b] = pzm2ab(pzm, fs);
0045 
0046 % make MIIR filter
0047 f = miir(a,b,fs);
0048 
0049 
0050 % END

Generated on Fri 08-Jun-2007 16:09:11 by m2html © 2003