comparison m-toolbox/classes/@parfrac/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 in
5 % the model.
6 %
7 % CALL: f = getupperFreq(pf);
8 %
9 % <a href="matlab:utils.helper.displayMethodInfo('parfrac', 'getupperFreq')">Parameters Description</a>
10 %
11 % VERSION: $Id: getupperFreq.m,v 1.10 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 % Some input checking
24 if length(varargin) > 1 || length(varargin{1}) > 1
25 error('### This method works only with one input.');
26 end
27
28 pf = varargin{1};
29 pls = pf.poles;
30 np = length(pls);
31 f = 0;
32 for jj=1:np
33 fp = sqrt(real(pls(jj))^2 + imag(pls(jj))^2)/(2*pi);
34 if fp > f
35 f = fp;
36 end
37 end
38
39 % Set outputs
40 varargout{1} = f;
41 end
42
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 % Local Functions %
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 %
49 % FUNCTION: getInfo
50 %
51 % DESCRIPTION: Get Info Object
52 %
53 % HISTORY: 11-07-07 M Hewitson
54 % Creation.
55 %
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57
58 function ii = getInfo(varargin)
59 if nargin == 1 && strcmpi(varargin{1}, 'None')
60 sets = {};
61 pl = [];
62 else
63 sets = {'Default'};
64 pl = getDefaultPlist;
65 end
66 % Build info object
67 ii = minfo(mfilename, 'parfrac', 'ltpda', utils.const.categories.internal, '$Id: getupperFreq.m,v 1.10 2011/04/08 08:56:33 hewitson Exp $', sets, pl);
68 ii.setModifier(false);
69 end
70
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 %
73 % FUNCTION: getDefaultPlist
74 %
75 % DESCRIPTION: Get Default Plist
76 %
77 % HISTORY: 11-07-07 M Hewitson
78 % Creation.
79 %
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81
82 function plout = getDefaultPlist()
83 persistent pl;
84 if exist('pl', 'var')==0 || isempty(pl)
85 pl = buildplist();
86 end
87 plout = pl;
88 end
89
90 function pl = buildplist()
91 pl = plist.EMPTY_PLIST;
92 end
93