Mercurial > hg > ltpda
comparison m-toolbox/classes/@miir/miir.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children | a71a40911c27 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % MIIR IIR filter object class constructor. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: MIIR IIR filter object class constructor. | |
5 % Create a miir object. | |
6 % | |
7 % | |
8 % CONSTRUCTORS: | |
9 % | |
10 % f = miir() - creates an empty miir object. | |
11 % f = miir(fi) - creates a copy of the input miir object, fi. | |
12 % f = miir(pzm) - creates a miir object from a pole/zero model | |
13 % f = miir(pf) - creates a vector of miir objects from a parfrac model | |
14 % f = miir(a,b,fs) - creates a miir object from the coefficient | |
15 % vectors 'a' and 'b' **. | |
16 % The sample rate for which the filter is | |
17 % designed should be specified as well. | |
18 % f = miir('foo_iir.fil') - create a miir object from a | |
19 % LISO IIR .fil file. | |
20 % f = miir('foo_iir.xml') - create a miir object loading the miir object | |
21 % from disk. | |
22 % f = miir('foo_iir.mat') - create a miir object loading the miir object | |
23 % from disk. | |
24 % f = miir(pl) - create a miir object from the description | |
25 % given in the parameter list. | |
26 % | |
27 % | |
28 % EXAMPLE 1: Create an order 1 highpass filter with high frequency gain 2. | |
29 % Filter is designed for 10 Hz sampled data and has a cut-off | |
30 % frequency of 0.2 Hz. | |
31 % | |
32 % >> pl = plist('type', 'highpass', ... | |
33 % 'order', 1, ... | |
34 % 'gain', 2.0, ... | |
35 % 'fs', 10, ... | |
36 % 'fc', 0.2); | |
37 % >> f = miir(pl) | |
38 % | |
39 % NOTES: ** The convention used here for naming the filter coefficients is | |
40 % the opposite to MATLAB's convention. The recursion formula | |
41 % for this convention is | |
42 % | |
43 % b(1)*y(n) = a(1)*x(n) + a(2)*x(n-1) + ... + a(na+1)*x(n-na) | |
44 % - b(2)*y(n-1) - ... - b(nb+1)*y(n-nb) | |
45 % | |
46 % <a href="matlab:utils.helper.displayMethodInfo('miir', 'miir')">Parameters Description</a> | |
47 % | |
48 % | |
49 % VERSION: $Id: miir.m,v 1.130 2011/08/15 12:22:57 hewitson Exp $ | |
50 % | |
51 % SEE ALSO: mfir, ltpda_filter, ltpda_uoh, ltpda_uo, ltpda_obj, plist | |
52 % | |
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
54 | |
55 classdef miir < ltpda_filter | |
56 | |
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
58 % Property definition % | |
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
60 | |
61 %---------- Public (read/write) Properties ---------- | |
62 properties | |
63 end | |
64 | |
65 %---------- Protected read-only Properties ---------- | |
66 properties (SetAccess = protected) | |
67 b = []; % set of denominator coefficients | |
68 histin = []; % input history values to filter | |
69 end | |
70 | |
71 %---------- Protected read-only Properties ---------- | |
72 properties (SetAccess = protected, Dependent = true) | |
73 ntaps % number of coefficients in the filter | |
74 end | |
75 | |
76 %---------- Private Properties ---------- | |
77 properties (GetAccess = protected, SetAccess = protected) | |
78 end | |
79 | |
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
81 % Check property setting % | |
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
83 | |
84 methods | |
85 function set.histin(obj, val) | |
86 if ~isempty(val) | |
87 if ~isnumeric(val) || ~isreal(val) | |
88 error('### The value for the property ''histin'' must be a real number(s)'); | |
89 end | |
90 end | |
91 obj.histin = val; | |
92 end | |
93 function set.b(obj, val) | |
94 if ~isempty(val) | |
95 if ~isnumeric(val) | |
96 error('### The value for the property ''b'' must be a number(s)'); | |
97 end | |
98 end | |
99 obj.b = val; | |
100 end | |
101 function set.ntaps(obj, val) | |
102 error('### Don''t set the property ''ntaps''. It is computed by max(length(a), length(b)).'); | |
103 end | |
104 end | |
105 | |
106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
107 % Compute the Dependent properties % | |
108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
109 | |
110 methods | |
111 function val = get.ntaps(obj) | |
112 val = max(length(obj.a), length(obj.b)); | |
113 end | |
114 end | |
115 | |
116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
117 % Constructor % | |
118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
119 | |
120 methods | |
121 function obj = miir(varargin) | |
122 | |
123 import utils.const.* | |
124 utils.helper.msg(msg.PROC3, 'running %s/%s', mfilename('class'), mfilename); | |
125 | |
126 % Collect all miir objects | |
127 [fs, invars, rest] = utils.helper.collect_objects(varargin(:), 'miir'); | |
128 | |
129 if isempty(rest) && ~isempty(fs) | |
130 % Do copy constructor and return | |
131 utils.helper.msg(msg.OPROC1, 'copy constructor'); | |
132 obj = copy(fs, 1); | |
133 for kk=1:numel(obj) | |
134 obj(kk).addHistory(miir.getInfo('miir', 'None'), [], [], obj(kk).hist); | |
135 end | |
136 return | |
137 end | |
138 | |
139 if nargin == 0 | |
140 %%%%%%%%%% f = miir() %%%%%%%%%% | |
141 utils.helper.msg(msg.OPROC1, 'empty constructor'); | |
142 obj.addHistory(miir.getInfo('miir', 'None'), plist(), [], []); | |
143 | |
144 elseif nargin == 1 | |
145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
146 %%%%%%%%%%%%%%%%%%%%%%%%%%% one input %%%%%%%%%%%%%%%%%%%%%%%%%%% | |
147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
148 | |
149 if ischar(varargin{1}) | |
150 %%%%%%%%%% f = miir('foo.mat') %%%%%%%%%% | |
151 %%%%%%%%%% f = miir('foo.xml') %%%%%%%%%% | |
152 utils.helper.msg(msg.OPROC1, 'constructing from file %s', varargin{1}); | |
153 obj = fromFile(obj, plist('filename', varargin{1})); | |
154 | |
155 elseif isstruct(varargin{1}) | |
156 %%%%%%%%%% f = miir(struct) %%%%%%%%%% | |
157 utils.helper.msg(msg.OPROC1, 'constructing from struct'); | |
158 obj = fromStruct(obj, varargin{1}); | |
159 | |
160 elseif isa(varargin{1}, 'parfrac') | |
161 %%%%%%%%%% f = miir(plist-object) %%%%%%%%%% | |
162 utils.helper.msg(msg.OPROC1, 'constructing from parfrac'); | |
163 obj = fromParfrac(obj, plist('parfrac', varargin{1})); | |
164 | |
165 elseif isa(varargin{1}, 'pzmodel') | |
166 %%%%%%%%%% f = miir(pzmodel-object) %%%%%%%%%% | |
167 utils.helper.msg(msg.OPROC1, 'constructing from pzmodel %s', varargin{1}.name); | |
168 % obj = fromPzmodel(obj, plist('pzmodel', varargin{1})); | |
169 obj = fromPzmodel(obj, varargin{1}, []); | |
170 | |
171 elseif isa(varargin{1}, 'plist') | |
172 %%%%%%%%%% f = miir(plist-object) %%%%%%%%%% | |
173 pl = varargin{1}; | |
174 | |
175 % Selection of construction method | |
176 if pl.isparam('filename') | |
177 utils.helper.msg(msg.OPROC1, 'constructing from file %s', pl.find('filename')); | |
178 obj = fromFile(obj, pl); | |
179 | |
180 elseif pl.isparam('hostname') || pl.isparam('conn') | |
181 utils.helper.msg(msg.OPROC1, 'constructing from repository %s', pl.find('hostname')); | |
182 obj = obj.fromRepository(pl); | |
183 | |
184 elseif pl.isparam('delay') | |
185 | |
186 utils.helper.msg(msg.OPROC1, 'constructing allpass'); | |
187 obj = fromAllpass(obj, pl); | |
188 | |
189 elseif pl.isparam('type') | |
190 utils.helper.msg(msg.OPROC1, 'constructing from standard %s', pl.find('type')); | |
191 obj = fromStandard(obj, pl); | |
192 | |
193 elseif pl.isparam('pzmodel') | |
194 utils.helper.msg(msg.OPROC1, 'constructing from pzmodel'); | |
195 obj = fromPzmodel(obj, [], pl); | |
196 % obj = fromPzmodel(obj, pl); | |
197 | |
198 elseif pl.isparam('a') | |
199 utils.helper.msg(msg.OPROC1, 'constructing from A/B coefficients'); | |
200 obj = fromAB(obj, pl); | |
201 | |
202 elseif pl.isparam('parfrac') | |
203 utils.helper.msg(msg.OPROC1, 'constructing from parfrac object'); | |
204 obj = fromParfrac(obj, pl); | |
205 | |
206 elseif pl.isparam('built-in') | |
207 utils.helper.msg(msg.OPROC1, 'constructing from built-in model'); | |
208 obj = fromModel(obj, pl); | |
209 | |
210 elseif pl.isparam('plist') | |
211 %--- Construct from plist | |
212 % if the plist is empty, we return an empty MIIR | |
213 ipl = find(pl, 'plist'); | |
214 if nparams(ipl) == 0 | |
215 obj = miir(); | |
216 else | |
217 % do plist constructor | |
218 obj = miir(ipl); | |
219 end | |
220 | |
221 else | |
222 obj.setObjectProperties(pl); | |
223 obj.addHistory(miir.getInfo('miir', 'None'), pl, [], []); | |
224 end | |
225 | |
226 else | |
227 error('### Unknown single argument constructor.'); | |
228 end | |
229 elseif nargin == 2 | |
230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
231 %%%%%%%%%%%%%%%%%%%%%%%%%%% two input %%%%%%%%%%%%%%%%%%%%%%%%%%% | |
232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
233 | |
234 if isa(varargin{1}, 'pzmodel') && isa(varargin{2}, 'plist') | |
235 %%%%%%%%%% f = miir(pzmodel-object, plist-object) %%%%%%%%%% | |
236 utils.helper.msg(msg.OPROC1, 'constructing from pzmodel %s', varargin{1}.name); | |
237 % obj = fromPzmodel(obj, combine(plist('pzmodel', varargin{1}), varargin{2})); | |
238 obj = fromPzmodel(obj, varargin{1}, varargin{2}); | |
239 | |
240 elseif (isa(varargin{1}, 'miir') || isa(varargin{1}, 'parfrac')) && isa(varargin{2}, 'plist') && isempty(varargin{2}.params) | |
241 %%%%%%%%%% f = miir(miir-object, <empty plist>) %%%%%%%%%% | |
242 %%%%%%%%%% f = miir(parfrac-object, <empty plist>) %%%%%%%%%% | |
243 % pass to copy constructor | |
244 obj = miir(varargin{1}); | |
245 | |
246 elseif (isa(varargin{1}, 'parfrac')) && isa(varargin{2}, 'plist') && ~isempty(varargin{2}.params) | |
247 %%%%%%%%%% f = miir(parfrac-object, plist-object) %%%%%%%%%% | |
248 plf = combine(plist('parfrac', varargin{1}),varargin{2}); | |
249 obj = fromParfrac(obj, plf); | |
250 | |
251 elseif (isa(varargin{1}, 'database') || isa(varargin{1}, 'mpipeline.repository.RepositoryConnection')) && isnumeric(varargin{2}) | |
252 %%%%%%%%%% f = miir(<database-object>, [IDs]) %%%%%%%%%% | |
253 utils.helper.msg(msg.OPROC1, 'retrieve from repository'); | |
254 obj = obj.fromRepository(plist('conn', varargin{1}, 'id', varargin{2})); | |
255 | |
256 elseif isa(varargin{1}, 'org.apache.xerces.dom.DeferredElementImpl') && ... | |
257 isa(varargin{2}, 'history') | |
258 %%%%%%%%%% obj = miir(DOM node, history-objects) %%%%%%%%%% | |
259 obj = fromDom(obj, varargin{1}, varargin{2}); | |
260 | |
261 elseif isa(varargin{1}, 'ltpda_uoh') && isa(varargin{2}, 'plist') | |
262 %%%%%%%%%%% miir(<ltpda_uoh>-object, plist-object) %%%%%%%%%% | |
263 % always recreate from plist | |
264 | |
265 % If we are trying to load from file, and the file exists, do | |
266 % that. Otherwise, copy the input object. | |
267 if varargin{2}.isparam('filename') | |
268 if exist(fullfile('.', find(varargin{2}, 'filename')), 'file')==2 | |
269 obj = miir(varargin{2}); | |
270 else | |
271 obj = miir(varargin{1}); | |
272 end | |
273 else | |
274 obj = miir(varargin{2}); | |
275 end | |
276 else | |
277 error('### Unknown 2 argument constructor.'); | |
278 end | |
279 | |
280 elseif nargin == 3 | |
281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
282 %%%%%%%%%%%%%%%%%%%%%%%%%% three input %%%%%%%%%%%%%%%%%%%%%%%%%% | |
283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
284 | |
285 utils.helper.msg(msg.OPROC1, 'constructing from A/B coefficients'); | |
286 %%%%%%%%%% f = miir(a, b, fs) %%%%%%%%%% | |
287 % a,b,fs constructor | |
288 obj = fromAB(obj, plist('a', varargin{1}, 'b', varargin{2}, 'fs', varargin{3})); | |
289 else | |
290 [iirs, invars, rest] = utils.helper.collect_objects(args, 'miir'); | |
291 | |
292 %%% Do we have a list of MIIR objects as input | |
293 if ~isempty(iirs) && isempty(rest) | |
294 obj = miir(iirs); | |
295 else | |
296 error('### Unknown number of constructor arguments.'); | |
297 end | |
298 end | |
299 end % End constructor | |
300 | |
301 end % End public methods | |
302 | |
303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
304 % Methods (static) % | |
305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
306 methods (Static) | |
307 | |
308 function mdls = getBuiltInModels(varargin) | |
309 mdls = ltpda_uo.getBuiltInModels('miir'); | |
310 end | |
311 | |
312 function out = VEROUT() | |
313 out = '$Id: miir.m,v 1.130 2011/08/15 12:22:57 hewitson Exp $'; | |
314 end | |
315 | |
316 function ii = getInfo(varargin) | |
317 ii = utils.helper.generic_getInfo(varargin{:}, 'miir'); | |
318 end | |
319 | |
320 function out = SETS() | |
321 out = [SETS@ltpda_uoh, ... | |
322 {'From LISO File'}, ... | |
323 {'From Standard Type'}, ... | |
324 {'Allpass'}, ... | |
325 {'From Parfrac'}, ... | |
326 {'From Pzmodel'}, ... | |
327 {'From AB'}]; | |
328 end | |
329 | |
330 function plout = getDefaultPlist(set) | |
331 persistent pl; | |
332 persistent lastset; | |
333 if exist('pl', 'var')==0 || isempty(pl) || ~strcmp(lastset, set) | |
334 pl = miir.buildplist(set); | |
335 lastset = set; | |
336 end | |
337 plout = pl; | |
338 end | |
339 | |
340 function out = buildplist(set) | |
341 | |
342 if ~utils.helper.ismember(lower(miir.SETS), lower(set)) | |
343 error('### Unknown set [%s]', set); | |
344 end | |
345 | |
346 out = plist(); | |
347 out = miir.addGlobalKeys(out); | |
348 out = buildplist@ltpda_uoh(out, set); | |
349 | |
350 switch lower(set) | |
351 case 'allpass' | |
352 | |
353 % Delay | |
354 p = param({'delay','The allpass delay.'}, paramValue.EMPTY_DOUBLE); | |
355 out.append(p); | |
356 | |
357 % N | |
358 p = param({'N','The filter order.'}, paramValue.DOUBLE_VALUE(1)); | |
359 out.append(p); | |
360 | |
361 % Method | |
362 p = param({'method','The method for generating the filter.'}, {1, {'thirlen'}, paramValue.SINGLE}); | |
363 out.append(p); | |
364 | |
365 % Iunits | |
366 p = param({'iunits','The input units of the filter.'}, paramValue.EMPTY_STRING); | |
367 out.append(p); | |
368 | |
369 % Ounits | |
370 p = param({'ounits','The output units of the filter.'}, paramValue.EMPTY_STRING); | |
371 out.append(p); | |
372 | |
373 case 'from ab' | |
374 | |
375 % A | |
376 p = param({'a','Set of numerator coefficients.'}, paramValue.EMPTY_DOUBLE); | |
377 out.append(p); | |
378 | |
379 % B | |
380 p = param({'b','Set of denominator coefficients.'}, paramValue.EMPTY_DOUBLE); | |
381 out.append(p); | |
382 | |
383 % Fs | |
384 p = param({'fs','The sampling frequency to design for.'}, paramValue.EMPTY_DOUBLE); | |
385 out.append(p); | |
386 | |
387 % Iunits | |
388 p = param({'iunits','The input units of the filter.'}, paramValue.EMPTY_STRING); | |
389 out.append(p); | |
390 | |
391 % Ounits | |
392 p = param({'ounits','The output units of the filter.'}, paramValue.EMPTY_STRING); | |
393 out.append(p); | |
394 | |
395 case 'from standard type' | |
396 | |
397 % Type | |
398 p = param({'type','Choose the filter type.'}, {2, {'highpass', 'lowpass', 'bandpass', 'bandreject'}, paramValue.SINGLE}); | |
399 out.append(p); | |
400 | |
401 % Fc | |
402 p = param({'fc','The roll-off frequency [Hz].'}, paramValue.DOUBLE_VALUE(0.1)); | |
403 out.append(p); | |
404 | |
405 % Gain | |
406 p = param({'gain','The gain of the filter.'}, paramValue.DOUBLE_VALUE(1)); | |
407 out.append(p); | |
408 | |
409 % Fs | |
410 p = param({'fs','The sampling frequency to design for.'}, paramValue.DOUBLE_VALUE(1)); | |
411 out.append(p); | |
412 | |
413 % Order | |
414 p = param({'order', 'The filter order.'}, paramValue.DOUBLE_VALUE(1)); | |
415 out.append(p); | |
416 | |
417 % Ripple | |
418 p = param({'ripple', 'Pass/stop-band ripple (%) for bandpass and bandreject filters.'}, paramValue.DOUBLE_VALUE(0.5)); | |
419 out.append(p); | |
420 | |
421 % % Win | |
422 % p = param({'win', 'A window to design with.'}, paramValue.WINDOW); | |
423 % out.append(p); | |
424 % | |
425 % Iunits | |
426 p = param({'iunits','The input units of the filter.'}, paramValue.EMPTY_STRING); | |
427 out.append(p); | |
428 | |
429 % Ounits | |
430 p = param({'ounits','The output units of the filter.'}, paramValue.EMPTY_STRING); | |
431 out.append(p); | |
432 | |
433 case 'from parfrac' | |
434 | |
435 % Parfrac | |
436 p = param({'parfrac','Parfrac object to design from.'}, {1, {parfrac}, paramValue.OPTIONAL}); | |
437 out.append(p); | |
438 | |
439 % Fs | |
440 p = param({'fs','The sampling frequency to design for.'}, paramValue.EMPTY_DOUBLE); | |
441 out.append(p); | |
442 | |
443 % Iunits | |
444 p = param({'iunits','The input units of the transfer function.'}, paramValue.EMPTY_STRING); | |
445 out.append(p); | |
446 | |
447 % Ounits | |
448 p = param({'ounits','The output units of the transfer function.'}, paramValue.EMPTY_STRING); | |
449 out.append(p); | |
450 | |
451 case 'from pzmodel' | |
452 | |
453 % pzmodel | |
454 p = param({'pzmodel','Pole/zero model object to design from.'}, {1, {pzmodel}, paramValue.OPTIONAL}); | |
455 out.append(p); | |
456 | |
457 % Fs | |
458 p = param({'fs','The sampling frequency to design for.'}, paramValue.EMPTY_DOUBLE); | |
459 out.append(p); | |
460 | |
461 % Iunits | |
462 p = param({'iunits','The input units of the transfer function.'}, paramValue.EMPTY_STRING); | |
463 out.append(p); | |
464 | |
465 % Ounits | |
466 p = param({'ounits','The output units of the transfer function.'}, paramValue.EMPTY_STRING); | |
467 out.append(p); | |
468 | |
469 case 'from liso file' | |
470 | |
471 % Filename | |
472 p = param({'filename','LISO filename.'}, paramValue.EMPTY_STRING); | |
473 out.append(p); | |
474 end | |
475 end % function out = getDefaultPlist(varargin) | |
476 | |
477 function obj = initObjectWithSize(n,m) | |
478 obj = miir.newarray([n m]); | |
479 end | |
480 | |
481 end % End static methods | |
482 | |
483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
484 % Methods (static, private) % | |
485 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
486 | |
487 methods (Static, Access=private) | |
488 | |
489 f = filload(filename) | |
490 plo = parseFilterParams(pl) | |
491 | |
492 end % End static, private methods | |
493 | |
494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
495 % Methods (static, hidden) % | |
496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
497 | |
498 methods (Static = true, Hidden = true) | |
499 varargout = loadobj(varargin) | |
500 varargout = update_struct(varargin); | |
501 end | |
502 | |
503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
504 % Methods (public) % | |
505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
506 | |
507 methods | |
508 varargout = char(varargin); | |
509 varargout = copy(varargin) | |
510 varargout = display(varargin); | |
511 | |
512 varargout = setHistin(varargin) | |
513 varargout = setB(varargin) | |
514 varargout = redesign(varargin) | |
515 end | |
516 | |
517 methods (Hidden = true) | |
518 varargout = attachToDom(varargin) | |
519 end | |
520 | |
521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
522 % Methods (protected) % | |
523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
524 | |
525 methods (Access = protected) | |
526 varargout = fromLISO(varargin) | |
527 varargout = fromStruct(varargin) | |
528 varargout = fromDom(varargin) | |
529 end | |
530 | |
531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
532 % Methods (private) % | |
533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
534 | |
535 methods (Access = private) | |
536 varargout = fromPzmodel(varargin) | |
537 f = fromParfrac(f, pli) | |
538 f = fromAB(f, pli) | |
539 f = fromStandard(f, pli) | |
540 | |
541 f = mklowpass(f, pl) | |
542 f = mkhighpass(f, pl) | |
543 f = mkbandpass(f, pl) | |
544 f = mkbandreject(f, pl) | |
545 end | |
546 | |
547 end % End classdef | |
548 | |
549 % END | |
550 | |
551 % Parameter sets for plist constructor (in order of priority): | |
552 % | |
553 % From XML File | |
554 % ------------- | |
555 % | |
556 % Construct an MIIR by loading it from an XML file. | |
557 % | |
558 % 'filename' - construct an MIIR from a filename. | |
559 % Example: plist('filename', 'm1.xml') | |
560 % [default: empty string] | |
561 % | |
562 % From MAT File | |
563 % ------------- | |
564 % | |
565 % Construct an MIIR by loading it from a MAT file. | |
566 % | |
567 % 'filename' - construct an MIIR from a filename. | |
568 % Example: plist('filename', 'm1.mat') | |
569 % [default: empty string] | |
570 % | |
571 % From LISO File | |
572 % -------------- | |
573 % | |
574 % Construct an MIIR by loading it from a LISO file. | |
575 % | |
576 % 'filename' - construct an MIIR from a filename. | |
577 % Example: plist('filename', 'm1.fil') | |
578 % [default: empty string] | |
579 % | |
580 % From Repository | |
581 % --------------- | |
582 % | |
583 % Construct an MIIR by retrieving it from an LTPDA repository. | |
584 % | |
585 % 'Hostname' - the repository hostname. Only those objects which | |
586 % are MIIRs are returned. | |
587 % [default: 'localhost']; | |
588 % | |
589 % Additional parameters: | |
590 % 'Database' - The database name [default: 'ltpda'] | |
591 % 'ID' - A vector of object IDs. [default: []] | |
592 % 'CID' - Retrieve all MIIR objects from a particular | |
593 % collection. | |
594 % 'Binary' - Set to 'yes' to retrieve from stored binary | |
595 % representation (not always available). | |
596 % | |
597 % From AB | |
598 % ------- | |
599 % | |
600 % Construct an MIIR from the A and B coefficients. | |
601 % | |
602 % 'a' - vector of A coefficients (see note ** below) [default: empty] | |
603 % 'b' - vector of B coefficients (see note ** below) [default: empty] | |
604 % 'fs' - sampling frequency of the filter [default: empty] | |
605 % 'name' - name of filter [default: 'None'] | |
606 % | |
607 % | |
608 % From Standard Type | |
609 % ------------------ | |
610 % | |
611 % Construct an MIIR of a standard type. | |
612 % | |
613 % 'type' - one of the types: 'highpass', 'lowpass', | |
614 % 'bandpass', 'bandreject' [default: 'lowpass'] | |
615 % | |
616 % You can also specify optional parameters: | |
617 % 'gain' - the gain of the filter [default: 1] | |
618 % 'fc' - the roll-off frequency [default: 0.1 Hz] | |
619 % 'fs' - the sampling frequency to design for [default: 1 Hz] | |
620 % 'order' - the filter order [default: 1] | |
621 % 'ripple' - pass/stop-band ripple for bandpass | |
622 % and bandreject filters [default: 0.5] | |
623 % 'iunits' - the input unit of the filter | |
624 % 'ounits' - the output unit of the filter | |
625 % | |
626 % From Parfrac | |
627 % ------------ | |
628 % | |
629 % Construct an MIIR from a parfrac. | |
630 % | |
631 % 'parfrac' - a parfrac object to construct the filters from [default: empty parfrac] | |
632 % 'fs' - sample rate for the filter(s) | |
633 % | |
634 % From Pzmodel | |
635 % ------------ | |
636 % | |
637 % Construct an MIIR from a pzmodel. | |
638 % | |
639 % 'pzmodel' - a pzmodel object to construct the filter from [default: empty pzmodel] | |
640 % 'fs' - sample rate for the filter | |
641 % | |
642 % From Plist | |
643 % ---------- | |
644 % | |
645 % 'Plist' - construct from a plist. The value passed should be a plist | |
646 % object. | |
647 % [default: empty plist] |