comparison m-toolbox/classes/@pzmodel/getupperFreq.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 % GETUPPERFREQ gets the frequency of the highest pole or zero in the model.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: GETUPPERFREQ gets the frequency of the highest pole or zero in
5 % the model.
6 %
7 % CALL: f = getupperFreq(pzm);
8 %
9 % <a href="matlab:utils.helper.displayMethodInfo('pzmodel', 'getupperFreq')">Parameters Description</a>
10 %
11 % VERSION: $Id: getupperFreq.m,v 1.17 2011/04/08 08:56:32 hewitson Exp $
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15 function varargout = getupperFreq(varargin)
16
17 %%% Check if this is a call for parameters
18 if utils.helper.isinfocall(varargin{:})
19 varargout{1} = getInfo(varargin{3});
20 return
21 end
22
23 pzm = varargin{1};
24
25 % Some input checking
26 if length(pzm) > 1
27 error('### This method works only with one input.');
28 end
29
30 poles = pzm.poles;
31 zeros = pzm.zeros;
32 np = numel(poles);
33 nz = numel(zeros);
34 f = 0;
35 for j=1:np
36 pole = poles(j);
37 fc = pole.f;
38 if fc > f
39 f = fc;
40 end
41 end
42
43 for j=1:nz
44 zero = zeros(j);
45 fc = zero.f;
46 if fc > f
47 f = fc;
48 end
49 end
50 if np==0 && nz==0
51 f = 1;
52 end
53
54 % Set outputs
55 varargout{1} = f;
56 end
57
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 % Local Functions %
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 %
64 % FUNCTION: getInfo
65 %
66 % DESCRIPTION: Get Info Object
67 %
68 % HISTORY: 11-07-07 M Hewitson
69 % Creation.
70 %
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72
73 function ii = getInfo(varargin)
74 if nargin == 1 && strcmpi(varargin{1}, 'None')
75 sets = {};
76 pl = [];
77 else
78 sets = {'Default'};
79 pl = getDefaultPlist;
80 end
81 % Build info object
82 ii = minfo(mfilename, 'pzmodel', 'ltpda', utils.const.categories.internal, '$Id: getupperFreq.m,v 1.17 2011/04/08 08:56:32 hewitson Exp $', sets, pl);
83 ii.setModifier(false);
84 end
85
86 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87 %
88 % FUNCTION: getDefaultPlist
89 %
90 % DESCRIPTION: Get Default Plist
91 %
92 % HISTORY: 11-07-07 M Hewitson
93 % Creation.
94 %
95 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96
97 function plout = getDefaultPlist()
98 persistent pl;
99 if exist('pl', 'var')==0 || isempty(pl)
100 pl = buildplist();
101 end
102 plout = pl;
103 end
104
105 function pl = buildplist()
106 pl = plist.EMPTY_PLIST;
107 end
108