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 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