Mercurial > hg > ltpda
comparison m-toolbox/classes/@pzmodel/getlowerFreq.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 % GETLOWERFREQ gets the frequency of the lowest pole or zero in the model. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: GETLOWERFREQ gets the frequency of the lowest pole or zero in the | |
5 % model. | |
6 % | |
7 % CALL: f = getlowerFreq(pzm); | |
8 % | |
9 % <a href="matlab:utils.helper.displayMethodInfo('pzmodel', 'getlowerFreq')">Parameters Description</a> | |
10 % | |
11 % VERSION: $Id: getlowerFreq.m,v 1.17 2011/04/08 08:56:32 hewitson Exp $ | |
12 % | |
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
14 | |
15 function varargout = getlowerFreq(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 = realmax; | |
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 | |
51 if np==0 && nz==0 | |
52 f = realmin; | |
53 end | |
54 | |
55 % Set outputs | |
56 varargout{1} = f; | |
57 end | |
58 | |
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
60 % Local Functions % | |
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
62 | |
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
64 % | |
65 % FUNCTION: getInfo | |
66 % | |
67 % DESCRIPTION: Get Info Object | |
68 % | |
69 % HISTORY: 11-07-07 M Hewitson | |
70 % Creation. | |
71 % | |
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
73 | |
74 function ii = getInfo(varargin) | |
75 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
76 sets = {}; | |
77 pl = []; | |
78 else | |
79 sets = {'Default'}; | |
80 pl = getDefaultPlist; | |
81 end | |
82 % Build info object | |
83 ii = minfo(mfilename, 'pzmodel', 'ltpda', utils.const.categories.internal, '$Id: getlowerFreq.m,v 1.17 2011/04/08 08:56:32 hewitson Exp $', sets, pl); | |
84 ii.setModifier(false); | |
85 end | |
86 | |
87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
88 % | |
89 % FUNCTION: getDefaultPlist | |
90 % | |
91 % DESCRIPTION: Get Default Plist | |
92 % | |
93 % HISTORY: 11-07-07 M Hewitson | |
94 % Creation. | |
95 % | |
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
97 | |
98 function plout = getDefaultPlist() | |
99 persistent pl; | |
100 if exist('pl', 'var')==0 || isempty(pl) | |
101 pl = buildplist(); | |
102 end | |
103 plout = pl; | |
104 end | |
105 | |
106 function pl = buildplist() | |
107 pl = plist.EMPTY_PLIST; | |
108 end | |
109 |