Mercurial > hg > ltpda
comparison m-toolbox/classes/@mfir/fromA.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 coefficients | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % FUNCTION: fromA | |
5 % | |
6 % DESCRIPTION: Construct an mfir from coefficients | |
7 % | |
8 % CALL: f = fromA(f, pli) | |
9 % | |
10 % PARAMETER: pli: Parameter list object | |
11 % | |
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
13 | |
14 function f = fromA(f, pli) | |
15 | |
16 VERSION = '$Id: fromA.m,v 1.17 2011/08/15 11:36:50 hewitson Exp $'; | |
17 | |
18 ii = mfir.getInfo('mfir', 'From A'); | |
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 a = find(pl, 'a'); | |
26 fs = find(pl, 'fs'); | |
27 | |
28 % Checking the coefficients are listed in rows | |
29 if size(a,1)~=1 | |
30 a = a'; | |
31 end | |
32 | |
33 % Zero pad coefficients to avoid zero length history | |
34 if numel(a) <= 1 | |
35 a = [a 0]; | |
36 end | |
37 | |
38 f.fs = fs; | |
39 f.a = a; | |
40 f.gd = (f.ntaps-1)/2; | |
41 f.histout = zeros(1,f.ntaps-1); % initialise output history | |
42 | |
43 % Override some properties of the input plist | |
44 if isempty(pl.find('name')) | |
45 pl.pset('name', 'A'); | |
46 end | |
47 | |
48 % Add history | |
49 f.addHistory(ii, pl, [], []); | |
50 | |
51 % Set object properties | |
52 f.setObjectProperties(pl); | |
53 | |
54 end % End fromA |