Mercurial > hg > ltpda
comparison m-toolbox/classes/@rational/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 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(pf); | |
8 % | |
9 % <a href="matlab:utils.helper.displayMethodInfo('rational', 'getupperFreq')">Parameters Description</a> | |
10 % | |
11 % VERSION: $Id: getupperFreq.m,v 1.9 2011/04/08 08:56:33 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 pf = varargin{1}; | |
24 poles = roots(pf.den); | |
25 zeros = roots(pf.num); | |
26 | |
27 f = 0; | |
28 for j=1:numel(poles) | |
29 [fp,q] = utils.math.ri2fq(poles(j)); | |
30 if fp > f | |
31 f = fp; | |
32 end | |
33 end | |
34 for j=1:numel(zeros) | |
35 [fp,q] = utils.math.ri2fq(zeros(j)); | |
36 if fp > f | |
37 f = fp; | |
38 end | |
39 end | |
40 | |
41 % Set outputs | |
42 varargout{1} = f; | |
43 end | |
44 | |
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
46 % Local Functions % | |
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
48 | |
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
50 % | |
51 % FUNCTION: getInfo | |
52 % | |
53 % DESCRIPTION: Get Info Object | |
54 % | |
55 % HISTORY: 11-07-07 M Hewitson | |
56 % Creation. | |
57 % | |
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
59 | |
60 function ii = getInfo(varargin) | |
61 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
62 sets = {}; | |
63 pl = []; | |
64 else | |
65 sets = {'Default'}; | |
66 pl = getDefaultPlist; | |
67 end | |
68 % Build info object | |
69 ii = minfo(mfilename, 'rational', 'ltpda', utils.const.categories.internal, '$Id: getupperFreq.m,v 1.9 2011/04/08 08:56:33 hewitson Exp $', sets, pl); | |
70 ii.setModifier(false); | |
71 end | |
72 | |
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
74 % | |
75 % FUNCTION: getDefaultPlist | |
76 % | |
77 % DESCRIPTION: Get Default Plist | |
78 % | |
79 % HISTORY: 11-07-07 M Hewitson | |
80 % Creation. | |
81 % | |
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
83 | |
84 function plout = getDefaultPlist() | |
85 persistent pl; | |
86 if exist('pl', 'var')==0 || isempty(pl) | |
87 pl = buildplist(); | |
88 end | |
89 plout = pl; | |
90 end | |
91 | |
92 function pl = buildplist() | |
93 pl = plist.EMPTY_PLIST; | |
94 end | |
95 |