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.6 2007/07/18 13:58:45 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.6 2007/07/18 13:58:45 ingo Exp $
0017 %
0018 % HISTORY:     04-04-2007 M Hewitson
0019 %                 Creation
0020 %
0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 
0023 disp(sprintf('*** re-designing filter for fs=%2.2f Hz...', fs));
0024 fpl  = get(filt, 'plist');
0025 type = find(fpl, 'type');
0026 pzm  = find(fpl, 'pzmodel');
0027 
0028 if  strcmp(type, 'highpass') ||...
0029     strcmp(type, 'lowpass') ||...
0030     strcmp(type, 'bandpass') ||...
0031     strcmp(type, 'bandreject')
0032 
0033   disp('   - re-designing standard filter.');
0034   try
0035     fpl = set(fpl, 'fs', fs);
0036     disp('   - setting new fs.');
0037   catch
0038     fpl = append(fpl, 'fs', fs);
0039     disp('   - appending parameter fs.');
0040   end
0041   filtnew = miir(fpl);
0042   filtnew = set(filtnew, 'histin', get(filt, 'histin'));
0043   filtnew = set(filtnew, 'histout', get(filt, 'histout'));
0044   filt = filtnew;
0045 elseif ~isempty(pzm)
0046 
0047   disp('   - re-designing pzmodel filter.');
0048   filtnew = miir(plist([param('pzmodel', pzm) param('fs', fs)]));
0049   filtnew = set(filtnew, 'histin', get(filt, 'histin'));
0050   filtnew = set(filtnew, 'histout', get(filt, 'histout'));
0051   filt = filtnew;
0052 
0053 else
0054 
0055   warning('!!! un-recognised input filter type. Can''t redesign.');
0056 
0057 
0058 
0059 end
0060 
0061 
0062 
0063 
0064 % END

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