Home > classes > @miir > redesign.m

redesign

PURPOSE ^

REDESIGN redesign the input filter to work for the given sample rate.

SYNOPSIS ^

function filt = redesign(filt, fs)

DESCRIPTION ^

 REDESIGN redesign the input filter to work for the given sample rate.

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

 DESCRIPTION: REDESIGN redesign the input filter to work for the given sample
              rate.

 CALL:        filt = redesign(filt, fs)

 INPUT:       filt - input (miir) filter
              fs   - new sample rate

 OUTPUT:      filt - new output filter

 VERSION:     $Id: redesign.m,v 1.8 2007/12/06 17:09:15 ingo Exp $

 HISTORY:     04-04-2007 M Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function filt = redesign(filt, fs)
0002 % REDESIGN redesign the input filter to work for the given sample rate.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: REDESIGN redesign the input filter to work for the given sample
0007 %              rate.
0008 %
0009 % CALL:        filt = redesign(filt, fs)
0010 %
0011 % INPUT:       filt - input (miir) filter
0012 %              fs   - new sample rate
0013 %
0014 % OUTPUT:      filt - new output filter
0015 %
0016 % VERSION:     $Id: redesign.m,v 1.8 2007/12/06 17:09:15 ingo Exp $
0017 %
0018 % HISTORY:     04-04-2007 M Hewitson
0019 %                 Creation
0020 %
0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 
0023 VERSION  = '$Id: redesign.m,v 1.8 2007/12/06 17:09:15 ingo Exp $';
0024 
0025 % Check if this is a call for parameters
0026 if nargin == 2
0027   if isa(filt, 'miir') && ischar(fs)
0028     in = char(fs);
0029     if strcmp(in, 'Params')
0030       filt = plist;
0031       return
0032     elseif strcmp(in, 'Version')
0033       filt = VERSION;
0034       return
0035     end
0036   end
0037 end
0038 
0039 disp(sprintf('*** re-designing filter for fs=%2.2f Hz...', fs));
0040 fpl  = get(filt, 'plist');
0041 type = find(fpl, 'type');
0042 pzm  = find(fpl, 'pzmodel');
0043 
0044 if  strcmp(type, 'highpass') ||...
0045     strcmp(type, 'lowpass') ||...
0046     strcmp(type, 'bandpass') ||...
0047     strcmp(type, 'bandreject')
0048 
0049   disp('   - re-designing standard filter.');
0050   try
0051     fpl = pset(fpl, 'fs', fs);
0052     disp('   - setting new fs.');
0053   catch
0054     fpl = append(fpl, 'fs', fs);
0055     disp('   - appending parameter fs.');
0056   end
0057   filtnew = miir(fpl);
0058   filtnew = set(filtnew, 'histin', get(filt, 'histin'));
0059   filtnew = set(filtnew, 'histout', get(filt, 'histout'));
0060   filt = filtnew;
0061 elseif ~isempty(pzm)
0062 
0063   disp('   - re-designing pzmodel filter.');
0064   filtnew = miir(plist([param('pzmodel', pzm) param('fs', fs)]));
0065   filtnew = set(filtnew, 'histin', get(filt, 'histin'));
0066   filtnew = set(filtnew, 'histout', get(filt, 'histout'));
0067   filt = filtnew;
0068 
0069 else
0070 
0071   warning('!!! un-recognised input filter type. Can''t redesign.');
0072 
0073 
0074 
0075 end
0076 
0077 
0078 
0079 
0080 % END

Generated on Tue 22-Jan-2008 10:39:13 by m2html © 2003