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.8 2007/12/06 17:09:15 ingo Exp $';
0024
0025
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