This file is indexed.

/usr/share/octave/packages/control-2.6.2/mixsyn.m is in octave-control 2.6.2-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
## Copyright (C) 2009-2014   Lukas F. Reichlin
##
## This file is part of LTI Syncope.
##
## LTI Syncope is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## LTI Syncope is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with LTI Syncope.  If not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn{Function File} {[@var{K}, @var{N}, @var{gamma}, @var{info}] =} mixsyn (@var{G}, @var{W1}, @var{W2}, @var{W3}, @dots{})
## Solve stacked S/KS/T H-infinity problem.
## Mixed-sensitivity is the name given to transfer function shaping problems in which
## the sensitivity function
## @iftex
## @tex
## $ S = (I + G K)^{-1} $
## @end tex
## @end iftex
## @ifnottex
## @example
##              -1
## S = (I + G K)
## @end example
## @end ifnottex
## is shaped along with one or more other closed-loop transfer functions such as @var{K S}
## or the complementary sensitivity function
## @iftex
## @tex
## $ T = I - S = (I + G K)^{-1} G K $
## @end tex
## @end iftex
## @ifnottex
## @example
##                      -1
## T = I - S = (I + G K)
## @end example
## @end ifnottex
## in a typical one degree-of-freedom configuration, where @var{G} denotes the plant and
## @var{K} the (sub-)optimal controller to be found.  The shaping of multivariable
## transfer functions is based on the idea that a satisfactory definition of gain
## (range of gain) for a matrix transfer function is given by the singular values
## @iftex
## @tex
## $\\sigma$
## @end tex
## @end iftex
## @ifnottex
## 
## @end ifnottex
## of the transfer function. Hence the classical loop-shaping ideas of feedback design
## can be generalized to multivariable systems.  In addition to the requirement that
## @var{K} stabilizes @var{G}, the closed-loop objectives are as follows [1]:
## @enumerate
## @item For @emph{disturbance rejection} make
## @iftex
## @tex
## $\\overline{\\sigma}(S)$
## @end tex
## @end iftex
## @ifnottex
## 
## @end ifnottex
## small.
## @item For @emph{noise attenuation} make
## @iftex
## @tex
## $\\overline{\\sigma}(T)$
## @end tex
## @end iftex
## @ifnottex
## 
## @end ifnottex
## small.
## @item For @emph{reference tracking} make
## @iftex
## @tex
## $\\overline{\\sigma}(T) \\approx \\underline{\\sigma}(T) \\approx 1$.
## @end tex
## @end iftex
## @ifnottex
## 
## @end ifnottex
## @item For @emph{input usage (control energy) reduction} make
## @iftex
## @tex
## $\\overline{\\sigma}(K S)$
## @end tex
## @end iftex
## @ifnottex
## 
## @end ifnottex
## small.
## @item For @emph{robust stability} in the presence of an additive perturbation
## @iftex
## @tex
## $G_p = G + \\Delta$,
## @end tex
## @end iftex
## @ifnottex
## 
## @end ifnottex
## make
## @iftex
## @tex
## $\\overline{\\sigma}(K S)$
## @end tex
## @end iftex
## @ifnottex
## 
## @end ifnottex
## small.
## @item For @emph{robust stability} in the presence of a multiplicative output perturbation
## @iftex
## @tex
## $G_p = (I + \\Delta) G$,
## @end tex
## @end iftex
## @ifnottex
## 
## @end ifnottex
## make
## @iftex
## @tex
## $\\overline{\\sigma}(T)$
## @end tex
## @end iftex
## @ifnottex
## 
## @end ifnottex
## small.
## @end enumerate
## In order to find a robust controller for the so-called stacked
## @iftex
## @tex
## $S/KS/T \\ H_{\\infty}$
## @end tex
## @end iftex
## @ifnottex
## S/KS/T H-infinity
## @end ifnottex
## problem, the user function @command{mixsyn} minimizes the following criterion
## @iftex
## @tex
## $$ \\underset{K}{\\min} || N(K) ||_{\\infty}, \\quad N = | W_1 S; \\ W_2 K S; \\ W_3 T |$$
## @end tex
## @end iftex
## @ifnottex
## @example
##                              | W1 S   |
## min || N(K) ||           N = | W2 K S |
##  K            oo             | W3 T   |
## @end example
## @end ifnottex
## @code{[K, N] = mixsyn (G, W1, W2, W3)}.
## The user-defined weighting functions @var{W1}, @var{W2} and @var{W3} bound the largest
## singular values of the closed-loop transfer functions @var{S} (for performance),
## @var{K S} (to penalize large inputs) and @var{T} (for robustness and to avoid
## sensitivity to noise), respectively [1].
## A few points are to be considered when choosing the weights.
## The weigths @var{Wi} must all be proper and stable.  Therefore if one wishes,
## for example, to minimize @var{S} at low frequencies by a weighting @var{W1} including
## integral action, 
## @iftex
## @tex
## ${1 \\over s}$
## @end tex
## @end iftex
## @ifnottex
## @example
## 1
## -
## s
## @end example
## @end ifnottex
## needs to be approximated by
## @iftex
## @tex
## ${1 \\over s + \\epsilon}$, where $\\epsilon \\ll 1$.
## @end tex
## @end iftex
## @ifnottex
## @example
##   1
## -----    where   e << 1.
## s + e
## @end example
## @end ifnottex
## Similarly one might be interested in weighting @var{K S} with a non-proper weight
## @var{W2} to ensure that @var{K} is small outside the system bandwidth.
## The trick here is to replace a non-proper term such as
## @iftex
## @tex
## $ 1 + \\tau_1 s $ by $ {1 + \\tau_1 s \\over 1 + \\tau_2 s} $, where
## @end tex
## @end iftex
## @ifnottex
## @example
##                 1 + T1 s
## 1 + T1 s   by   --------,   where   T2 << T1.
##                 1 + T2 s
## @end example
## @end ifnottex
## @iftex
## @tex
## $\\tau_2 \\ll \\tau_1$
## @end tex
## @end iftex
## [1, 2]. 
##
##
## @strong{Inputs}
## @table @var
## @item G
## @acronym{LTI} model of plant.
## @item W1
## @acronym{LTI} model of performance weight.  Bounds the largest singular values of sensitivity @var{S}.
## Model must be empty @code{[]}, SISO or of appropriate size.
## @item W2
## @acronym{LTI} model to penalize large control inputs.  Bounds the largest singular values of @var{KS}.
## Model must be empty @code{[]}, SISO or of appropriate size.
## @item W3
## @acronym{LTI} model of robustness and noise sensitivity weight.  Bounds the largest singular values of 
## complementary sensitivity @var{T}.  Model must be empty @code{[]}, SISO or of appropriate size.
## @item @dots{}
## Optional arguments of @command{hinfsyn}.  Type @command{help hinfsyn} for more information.
## @end table
##
## All inputs must be proper/realizable.
## Scalars, vectors and matrices are possible instead of @acronym{LTI} models.
##
## @strong{Outputs}
## @table @var
## @item K
## State-space model of the H-infinity (sub-)optimal controller.
## @item N
## State-space model of the lower LFT of @var{P} and @var{K}.
## @item info
## Structure containing additional information.
## @item info.gamma
## L-infinity norm of @var{N}.
## @item info.rcond
## Vector @var{rcond} contains estimates of the reciprocal condition
## numbers of the matrices which are to be inverted and
## estimates of the reciprocal condition numbers of the
## Riccati equations which have to be solved during the
## computation of the controller @var{K}.  For details,
## see the description of the corresponding SLICOT routine.
## @end table
##
## @strong{Block Diagram}
## @example
## @group
##
##                                     | W1 S   |
## gamma = min||N(K)||             N = | W2 K S | = lft (P, K)
##          K         inf              | W3 T   |
## @end group
## @end example
## @example
## @group
##                                                       +------+  z1
##             +---------------------------------------->|  W1  |----->
##             |                                         +------+
##             |                                         +------+  z2
##             |                 +---------------------->|  W2  |----->
##             |                 |                       +------+
##  r   +    e |   +--------+  u |   +--------+  y       +------+  z3
## ----->(+)---+-->|  K(s)  |----+-->|  G(s)  |----+---->|  W3  |----->
##        ^ -      +--------+        +--------+    |     +------+
##        |                                        |
##        +----------------------------------------+
## @end group
## @end example
## @example
## @group
##                +--------+
##                |        |-----> z1 (p1x1)          z1 = W1 e
##  r (px1) ----->|  P(s)  |-----> z2 (p2x1)          z2 = W2 u
##                |        |-----> z3 (p3x1)          z3 = W3 y
##  u (mx1) ----->|        |-----> e (px1)            e = r - y
##                +--------+
## @end group
## @end example
## @example
## @group
##                +--------+  
##        r ----->|        |-----> z
##                |  P(s)  |
##        u +---->|        |-----+ e
##          |     +--------+     |
##          |                    |
##          |     +--------+     |
##          +-----|  K(s)  |<----+
##                +--------+
## @end group
## @end example
## @example
## @group
##                +--------+      
##        r ----->|  N(s)  |-----> z
##                +--------+
## @end group
## @end example
## @example
## @group
## Extended Plant:  P = augw (G, W1, W2, W3)
## Controller:      K = mixsyn (G, W1, W2, W3)
## Entire System:   N = lft (P, K)
## Open Loop:       L = G * K
## Closed Loop:     T = feedback (L)
## @end group
## @end example
##
## @strong{Algorithm}@*
## Relies on functions @command{augw} and @command{hinfsyn},
## which use SLICOT SB10FD, SB10DD and SB10AD by courtesy of
## @uref{http://www.slicot.org, NICONET e.V.}
##
## @strong{References}@*
## [1] Skogestad, S. and Postlethwaite I. (2005)
## @cite{Multivariable Feedback Control: Analysis and Design:
## Second Edition}.  Wiley, Chichester, England.@*
## [2] Meinsma, G. (1995)
## @cite{Unstable and nonproper weights in H-infinity control}
## Automatica, Vol. 31, No. 11, pp. 1655-1658
##
## @seealso{hinfsyn, augw}
## @end deftypefn

## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
## Created: December 2009
## Version: 0.2

function [K, N, gamma, info] = mixsyn (G, W1 = [], W2 = [], W3 = [], varargin)

  if (nargin == 0)
    print_usage ();
  endif

  [p, m] = size (G);

  P = augw (G, W1, W2, W3);
  
  [K, N, gamma, info] = hinfsyn (P, p, m, varargin{:});

endfunction