-
Notifications
You must be signed in to change notification settings - Fork 0
/
hinfminus.m
75 lines (68 loc) · 2.01 KB
/
hinfminus.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
function [beta,ind] = hinfminus(sys,freq)
%HINFMINUS H-(infinity-) index of a stable transfer function matrix
% [BETA,IND] = HINFMINUS(SYS,FREQ) computes the H-(infinity-) index
% of the transfer function matrix G of the stable LTI system SYS.
% If FREQ is not specified or is an empty array, then BETA
% is the minimum H-infinity norm of the columns of G. If FREQ is a real
% vector of frequency values, then BETA is the minimum of the norms of
% the columns of the frequency responses of G evaluated for all values
% contained in FREQ. IND is the index of column for which the minimum is
% achieved.
%
% Note: The stability of SYS is not checked.
% Copyright 2018 A. Varga
% Author: A. Varga, 19-04-2018.
% Revisions:
narginchk(1,2)
nargoutchk(0,2)
% check input system form
if ~isa(sys,'lti')
error('The input system SYS must be an LTI system object')
end
m = size(sys,2);
if m == 0
beta = []; ind = [];
return
end
if nargin == 1
freq = [];
else
if ~isempty(freq)
validateattributes(freq, {'double'},{'real','vector','>=',0},'','FREQ',2)
end
end
beta = inf; ind = 1;
if ~isempty(freq)
% evaluate BETA as the minimum of the norms of columns of the frequency
% responses of G evaluated over all frequencies contained in FREQ
if isequal(freq,0)
% use DCGAIN if only frequency 0 is present
frgains = dcgain(sys);
for j = 1:m
temp = norm(frgains(:,j));
if beta > temp
beta = temp; ind = j;
end
end
else
for i = 1:length(freq)
frgains = freqresp(sys,freq(i));
for j = 1:m
temp = norm(frgains(:,j));
if beta > temp
beta = temp; ind = j;
end
end
end
end
else
% evaluate BETA as the minimum of H-infinity norms of the columns of G
for j = 1:m
temp = norm(sys(:,j),inf);
if beta > temp
beta = temp; ind = j;
end
end
end
% end HINFMINUS
end