comparison m-toolbox/classes/@rational/fromParfrac.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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % FUNCTION: fromParfrac
4 %
5 % DESCRIPTION: Construct a rational from parfrac model
6 %
7 % CALL: r = Parfrac(a, pl)
8 %
9 % PARAMETER: pl - plist
10 %
11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 function r = fromParfrac(r, pli)
13
14 VERSION = '$Id: fromParfrac.m,v 1.10 2011/08/15 12:41:52 hewitson Exp $';
15
16
17 % get pzmodel info
18 ii = rational.getInfo('rational', 'From Parfrac');
19
20 % Set the method version string in the minfo object
21 ii.setMversion([VERSION '-->' ii.mversion]);
22
23 % Combine input plist with default values
24 pl = applyDefaults(ii.plists, pli);
25
26 % Extrac model
27
28 pf = find(pl, 'parfrac');
29 [a,b] = residue(pf.res,pf.poles,pf.dir);
30
31 % Set fields
32 r.num = a;
33 r.den = b;
34
35 % Override model properties from the parfrac object
36
37 if isempty(pl.find('ounits'))
38 pl.pset('ounits', pf.ounits);
39 end
40
41 if isempty(pl.find('iunits'))
42 pl.pset('iunits', pf.iunits);
43 end
44
45 if isempty(pl.find('name'))
46 pl.pset('name', sprintf('rational(%s)', pf.name));
47 end
48
49 if isempty(pl.find('description'))
50 pl.pset('description', pf.description);
51 end
52
53 % Add history
54 r.addHistory(ii, pl, [], pf.hist);
55
56 % Set object properties
57 r.setObjectProperties(pl);
58
59 end