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