0001 function plo = parseFilterParams(pl)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 plo = plist();
0022
0023
0024 type = find(pl, 'type');
0025 if isempty(type)
0026 type = 'lowpass';
0027 disp('- using default type ''lowpass''');
0028 end
0029 plo = append(plo, param('type', type));
0030
0031
0032 gain = find(pl, 'gain');
0033 if isempty(gain)
0034 gain = 1.0;
0035 disp(['- using default gain ' num2str(gain)]);
0036 end
0037 plo = append(plo, param('gain', gain));
0038
0039
0040 order = find(pl, 'order');
0041 if isempty(order)
0042 order = 1.0;
0043 disp(['- using default order ' num2str(order)]);
0044 end
0045 plo = append(plo, param('order', order));
0046
0047
0048 fc = find(pl, 'fc');
0049 if isempty(fc)
0050 if strcmp(type, 'bandreject') | strcmp(type, 'bandpass')
0051 fc = [0.1 0.25];
0052 else
0053 fc = 0.1;
0054 end
0055 disp(['- using default fc ' num2str(fc)]);
0056 end
0057 plo = append(plo, param('fc', fc));
0058
0059
0060 fs = find(pl, 'fs');
0061 if isempty(fs)
0062 fs = 10*max(fc);
0063 warning([sprintf('!!! no sample rate specified. Designing for fs=%2.2fHz.', fs)...
0064 sprintf('\nThe filter will be redesigned later when used.')]);
0065 end
0066 plo = append(plo, param('fs', fs));
0067
0068
0069 ripple = find(pl, 'ripple');
0070 if isempty(ripple)
0071 ripple = 0.5;
0072 disp(['- using default ripple ' num2str(ripple)]);
0073 end
0074 plo = append(plo, param('ripple', ripple));
0075
0076
0077
0078