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.html,v 1.14 2008/03/31 10:27:39 hewitson Exp $';
0024 CATEGORY = 'Helper';
0025
0026
0027 if nargin == 2
0028 if isa(filt, 'mfir') && ischar(fs)
0029 in = char(fs);
0030 if strcmp(in, 'Params')
0031 filt = plist;
0032 return
0033 elseif strcmp(in, 'Version')
0034 filt = VERSION;
0035 return
0036 elseif strcmp(in, 'Category')
0037 filt = CATEGORY;
0038 return
0039 end
0040 end
0041 end
0042
0043 disp(sprintf('*** re-designing filter for fs=%2.2f Hz...', fs));
0044 fpl = get(filt, 'plist');
0045 type = find(fpl, 'type');
0046 pzm = find(fpl, 'pzmodel');
0047
0048 if strcmp(type, 'highpass') ||...
0049 strcmp(type, 'lowpass') ||...
0050 strcmp(type, 'bandpass') ||...
0051 strcmp(type, 'bandreject')
0052
0053 disp(' - re-designing standard filter.');
0054 try
0055 fpl = pset(fpl, 'fs', fs);
0056 disp(' - setting new fs.');
0057 catch
0058 fpl = append(fpl, 'fs', fs);
0059 disp(' - appending parameter fs.');
0060 end
0061 filtnew = mfir(fpl);
0062 filtnew = set(filtnew, 'histout', get(filt, 'histout'));
0063 filt = filtnew;
0064 elseif ~isempty(pzm)
0065
0066 disp(' - re-designing pzmodel filter.');
0067 filtnew = mfir(plist([param('pzmodel', pzm) param('fs', fs)]));
0068 filtnew = set(filtnew, 'histout', get(filt, 'histout'));
0069 filt = filtnew;
0070
0071 else
0072
0073 warning('!!! un-recognised input filter type. Can''t redesign.');
0074
0075
0076
0077 end
0078
0079
0080
0081
0082