comparison m-toolbox/classes/@mfir/fromPzmodel.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % Construct an mfir from a pzmodel
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % FUNCTION: fromPzmodel
5 %
6 % DESCRIPTION: Construct an mfir from a pzmodel
7 %
8 % CALL: f = fromPzmodel(f, pli)
9 %
10 % PARAMETER: type: String with filter type description
11 % pli: Parameter list object
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15 function f = fromPzmodel(f, pli)
16
17 VERSION = '$Id: fromPzmodel.m,v 1.15 2011/08/15 11:43:01 hewitson Exp $';
18 ii = mfir.getInfo('mfir', 'From Pzmodel');
19 % Set the method version string in the minfo object
20 ii.setMversion([VERSION '-->' ii.mversion]);
21
22 % Add default values
23 pl = applyDefaults(ii.plists, pli);
24
25 % Get parameters
26 pzm = find(pl, 'pzmodel');
27 fs = find(pl, 'fs');
28
29 if isempty(fs)
30 % get max freq in pzmodel
31 fs = 8*getupperFreq(pzm);
32 warning([sprintf('!!! no sample rate specified. Designing for fs=%2.2f Hz.', fs)...
33 sprintf('\nThe filter will be redesigned later when used.')]);
34 end
35 % make MIIR filter
36 f = tomfir(pzm, plist('fs', fs));
37
38 % override default input plist values
39 if isempty(pl.find('name'))
40 pl.pset('name', sprintf('fir(%s)', pzm.name));
41 end
42 if isempty(pl.find('description'))
43 pl.pset('description', pzm.description);
44 end
45 if isempty(pl.find('iunits'))
46 pl.pset('iunits', pzm.iunits);
47 end
48 if isempty(pl.find('ounits'))
49 pl.pset('ounits', pzm.ounits);
50 end
51
52 % Add history
53 f.addHistory(ii, pl, [], pzm.hist);
54
55 % Set remaining properties
56 f.setObjectProperties(pl);
57
58 end % End fromPzmodel