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.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 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.4 2007/07/18 13:58:45 ingo Exp $

 HISTORY:     03-04-2007 M Hewitson
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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.4 2007/07/18 13:58:45 ingo Exp $
0015 %
0016 % HISTORY:     03-04-2007 M Hewitson
0017 %                 Creation
0018 %
0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 
0021 ALGONAME = mfilename;
0022 VERSION  = '$Id: tomiir.m,v 1.4 2007/07/18 13:58:45 ingo Exp $';
0023 
0024 pzm = varargin{1};
0025 if ~isa(pzm, 'pzmodel')
0026   error('### first argument should be a pzmodel.');
0027 end
0028 
0029 if nargin < 1
0030   error('### incorrect number of inputs.');
0031 end
0032 
0033 % Get fs
0034 if nargin == 1
0035   warning('!!! Using default sample rate of 1Hz to design filter.');
0036   fs = 1;
0037 else
0038   if isa(varargin{2}, 'plist')
0039     pl = varargin{2};
0040     fs = find(pl, 'fs');
0041     if isempty(fs)
0042       error('### unknown parameter list.');
0043     end
0044   else
0045     fs = varargin{2};
0046   end
0047 end
0048 
0049 % get a and b coefficients
0050 [a,b] = pzm2ab(pzm, fs);
0051 
0052 % make MIIR filter
0053 f = miir(a,b,fs);
0054 
0055 
0056 % END

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003