Mercurial > hg > ltpda
comparison m-toolbox/classes/@pzmodel/char.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 % CHAR convert a pzmodel object into a string. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: CHAR convert a pzmodel object into a string. | |
5 % | |
6 % CALL: string = char(pzmodel) | |
7 % | |
8 % <a href="matlab:utils.helper.displayMethodInfo('pzmodel', 'char')">Parameters Description</a> | |
9 % | |
10 % VERSION: $Id: char.m,v 1.18 2011/04/08 08:56:32 hewitson Exp $ | |
11 % | |
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
13 | |
14 function varargout = char(varargin) | |
15 | |
16 %%% Check if this is a call for parameters | |
17 if utils.helper.isinfocall(varargin{:}) | |
18 varargout{1} = getInfo(varargin{3}); | |
19 return | |
20 end | |
21 | |
22 objs = utils.helper.collect_objects(varargin(:), 'pzmodel'); | |
23 | |
24 pstr = ''; | |
25 | |
26 for ii = 1:numel(objs) | |
27 if numel(objs(ii).poles(:))==0||numel(objs(ii).zeros(:))==0||numel(objs(ii).gain(:))==0 | |
28 pole='no pole'; | |
29 zero='no zero'; | |
30 K='no gain'; | |
31 else | |
32 poles= vertcat(objs(ii).poles(:).ri); | |
33 zeros= vertcat(objs(ii).zeros(:).ri); | |
34 K=utils.math.getk(zeros,poles,objs(ii).gain); | |
35 pole=num2str(poles(1)); | |
36 zero=num2str(zeros(1)); | |
37 for i=2:numel(poles) | |
38 pole= [pole, ';', num2str(poles(i))]; | |
39 end | |
40 for i=2:numel(zeros) | |
41 zero= [zero, ';' , num2str(zeros(i))]; | |
42 end | |
43 end | |
44 pstr = [pstr 'pzmodel(g:' num2str(K) ' p:' pole ' z:' zero '), ']; | |
45 end | |
46 | |
47 varargout{1} = pstr(1:end-2); | |
48 end | |
49 | |
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
51 % Local Functions % | |
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
53 | |
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
55 % | |
56 % FUNCTION: getInfo | |
57 % | |
58 % DESCRIPTION: Get Info Object | |
59 % | |
60 % HISTORY: 11-07-07 M Hewitson | |
61 % Creation. | |
62 % | |
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
64 | |
65 function ii = getInfo(varargin) | |
66 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
67 sets = {}; | |
68 pl = []; | |
69 else | |
70 sets = {'Default'}; | |
71 pl = getDefaultPlist; | |
72 end | |
73 % Build info object | |
74 ii = minfo(mfilename, 'pzmodel', 'ltpda', utils.const.categories.output, '$Id: char.m,v 1.18 2011/04/08 08:56:32 hewitson Exp $', sets, pl); | |
75 ii.setModifier(false); | |
76 end | |
77 | |
78 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
79 % | |
80 % FUNCTION: getDefaultPlist | |
81 % | |
82 % DESCRIPTION: Get Default Plist | |
83 % | |
84 % HISTORY: 11-07-07 M Hewitson | |
85 % Creation. | |
86 % | |
87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
88 | |
89 function plout = getDefaultPlist() | |
90 persistent pl; | |
91 if exist('pl', 'var')==0 || isempty(pl) | |
92 pl = buildplist(); | |
93 end | |
94 plout = pl; | |
95 end | |
96 | |
97 function pl = buildplist() | |
98 pl = plist.EMPTY_PLIST; | |
99 end | |
100 |