0001 function filt = redesign(filt, fs)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 VERSION = '$Id: redesign.m,v 1.3 2007/12/06 17:09:15 ingo Exp $';
0024
0025
0026 if nargin == 2
0027 if isa(filt, 'mfir') && 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 = mfir(fpl);
0058 filtnew = set(filtnew, 'histout', get(filt, 'histout'));
0059 filt = filtnew;
0060 elseif ~isempty(pzm)
0061
0062 disp(' - re-designing pzmodel filter.');
0063 filtnew = mfir(plist([param('pzmodel', pzm) param('fs', fs)]));
0064 filtnew = set(filtnew, 'histout', get(filt, 'histout'));
0065 filt = filtnew;
0066
0067 else
0068
0069 warning('!!! un-recognised input filter type. Can''t redesign.');
0070
0071
0072
0073 end
0074
0075
0076
0077
0078