0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 function varargout = redesign(varargin)
0028
0029
0030 if utils.helper.isinfocall(varargin{:})
0031 varargout{1} = getInfo(varargin{3});
0032 return
0033 end
0034
0035 import utils.const.*
0036 utils.helper.msg(msg.OMNAME, 'running %s/%s', mfilename('class'), mfilename);
0037
0038
0039 if nargout == 0
0040 error('### cat cannot be used as a modifier. Please give an output variable.');
0041 end
0042
0043
0044 [filt, filt_invars, rest] = utils.helper.collect_objects(varargin(:), 'miir');
0045
0046 if numel(rest) ~= 1 && ~isnumeric(rest{1})
0047 error('### Please specify the new sample rate.');
0048 end
0049 fs = rest{1};
0050
0051
0052 for kk = 1:numel(filt)
0053 utils.helper.msg(msg.OPROC1, 're-designing filter for fs=%2.2f Hz...', fs);
0054 fpl = filt(kk).hist.plistUsed;
0055 type = find(fpl, 'type');
0056 pzm = find(fpl, 'pzmodel');
0057
0058 if strcmpi(type, 'highpass') ||...
0059 strcmpi(type, 'lowpass') ||...
0060 strcmpi(type, 'bandpass') ||...
0061 strcmpi(type, 'bandreject')
0062
0063 utils.helper.msg(msg.OPROC2, 're-designing standard filter.');
0064 try
0065 fpl = pset(fpl, 'fs', fs);
0066 utils.helper.msg(msg.OPROC2, 'setting new fs.');
0067 catch
0068 fpl = append(fpl, 'fs', fs);
0069 utils.helper.msg(msg.OPROC2, 'appending parameter fs.');
0070 end
0071 filt(kk) = miir(fpl);
0072 filt(kk).setHistin(filt(kk).histin);
0073 filt(kk).setHistout(filt(kk).histout);
0074 elseif ~isempty(pzm)
0075
0076 utils.helper.msg(msg.OPROC2, 're-designing pzmodel filter.');
0077 filt(kk) = miir(plist('pzmodel', pzm, 'fs', fs));
0078 filt(kk).setHistin(filt(kk).histin);
0079 filt(kk).setHistout(filt(kk).histout);
0080 else
0081 warning('!!! un-recognised input filter type. Can''t redesign.');
0082 end
0083 end
0084
0085
0086 varargout{1} = filt;
0087
0088 end
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105 function ii = getInfo(varargin)
0106 if nargin == 1 && strcmpi(varargin{1}, 'None')
0107 sets = {};
0108 pl = [];
0109 else
0110 sets = {'Default'};
0111 pl = getDefaultPlist;
0112 end
0113
0114 ii = minfo(mfilename, 'miir', '', utils.const.categories.helper, '$Id: redesign.m,v 1.15 2008/09/04 15:29:31 ingo Exp $', sets, pl);
0115 end
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128 function plo = getDefaultPlist()
0129 plo = plist();
0130 end
0131