Home > classes > @mfir > 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.
 
 usage: filt = redesign(filt, fs)
 
 
 M Hewitson 04-04-07

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function filt = redesign(filt, fs)
0002 
0003 % REDESIGN redesign the input filter to work for the given sample rate.
0004 %
0005 % usage: filt = redesign(filt, fs)
0006 %
0007 %
0008 % M Hewitson 04-04-07
0009 %
0010 
0011 
0012 disp(sprintf('*** re-designing filter for fs=%2.2f Hz...', fs));
0013 fpl  = get(filt, 'plist');
0014 type = find(fpl, 'type');
0015 pzm  = find(fpl, 'pzmodel');
0016 
0017 if  strcmp(type, 'highpass') ||...
0018     strcmp(type, 'lowpass') ||...
0019     strcmp(type, 'bandpass') ||...
0020     strcmp(type, 'bandreject')
0021 
0022   disp('   - re-designing standard filter.');
0023   try
0024     fpl = set(fpl, 'fs', fs);
0025     disp('   - setting new fs.');
0026   catch
0027     fpl = append(fpl, 'fs', fs);
0028     disp('   - appending parameter fs.');
0029   end
0030   filtnew = mfir(fpl);
0031   filtnew = set(filtnew, 'histout', get(filt, 'histout'));
0032   filt = filtnew;
0033 elseif ~isempty(pzm)
0034   
0035   disp('   - re-designing pzmodel filter.');
0036   filtnew = mfir(plist([param('pzmodel', pzm) param('fs', fs)]));
0037   filtnew = set(filtnew, 'histout', get(filt, 'histout'));
0038   filt = filtnew;
0039   
0040 else
0041   
0042   warning('!!! un-recognised input filter type. Can''t redesign.');
0043   
0044   
0045   
0046 end
0047 
0048 
0049 
0050 
0051 % END

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