comparison m-toolbox/classes/@miir/fromAB.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 miir from coefficients
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % FUNCTION: fromAB
5 %
6 % DESCRIPTION: Construct an miir from coefficients
7 %
8 % CALL: f = fromAB(f, pli)
9 %
10 % PARAMETER: pli: Parameter list object
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 function f = fromAB(f, pli)
15
16 ii = miir.getInfo('miir', 'From AB');
17 % Set the method version string in the minfo object
18 ii.setMversion(['$Id: fromAB.m,v 1.22 2011/09/15 11:50:05 hewitson Exp $-->' ii.mversion]);
19
20 % Add default values
21 pl = applyDefaults(ii.plists, pli);
22
23 a = find(pl, 'a');
24 b = find(pl, 'b');
25 fs = find(pl, 'fs');
26
27 % Checking the coefficients are listed in rows
28 if size(a,1)~=1
29 a = a';
30 end
31 if size(b,1)~=1
32 b = b';
33 end
34
35 % Zero pad to avoid 0 length history vector
36 if numel(a) <= 1
37 a = [a 0];
38 end
39 if numel(b) <= 1
40 b = [b 0];
41 end
42
43 f.fs = fs;
44 f.a = a;
45 f.b = b;
46 f.histin = zeros(1,f.ntaps-1); % initialise input history
47 f.histout = zeros(1,f.ntaps-1); % initialise output history
48
49 if isempty(pl.find('name'))
50 pl.pset('name', 'AB');
51 end
52
53 % Add history
54 f.addHistory(ii, pl, [], []);
55
56 % Set object properties
57 f.setObjectProperties(pl, {'a', 'b', 'fs'});
58
59 end % End fromAB