3433
|
1 ## Copyright (C) 1996 Auburn University. All rights reserved. |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by the |
|
7 ## Free Software Foundation; either version 2, or (at your option) any |
|
8 ## later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 ## for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. |
|
18 |
|
19 ## -*- texinfo -*- |
3500
|
20 ## @deftypefn {Function File} {} starp (@var{inputs}) |
3433
|
21 ## @format |
|
22 ## |
|
23 ## sys = starp(P, K, ny, nu) |
|
24 ## |
|
25 ## Redheffer star product or upper/lower LFT, respectively. |
|
26 ## |
|
27 ## |
|
28 ## +-------+ |
|
29 ## --------->| |---------> |
|
30 ## | P | |
|
31 ## +--->| |---+ ny |
|
32 ## | +-------+ | |
|
33 ## +-------------------+ |
|
34 ## | | |
|
35 ## +----------------+ | |
|
36 ## | | |
|
37 ## | +-------+ | |
|
38 ## +--->| |------+ nu |
|
39 ## | K | |
|
40 ## --------->| |---------> |
|
41 ## +-------+ |
|
42 ## |
|
43 ## If ny and nu "consume" all inputs and outputs of K then the result |
|
44 ## is a lower fractional transformation. If ny and nu "consume" all |
|
45 ## inputs and outputs of P then the result is an upper fractional |
|
46 ## transformation. |
|
47 ## |
|
48 ## ny and/or nu may be negative (= negative feedback) |
|
49 ## @end format |
|
50 ## @end deftypefn |
|
51 |
|
52 ## Author: Kai P. Mueller <mueller@ifr.ing.tu-bs.de> |
|
53 ## Created: May 1998 |
|
54 |
|
55 function sys = starp (P, K, ny, nu); |
|
56 |
|
57 if((nargin != 2) && (nargin != 4)) |
|
58 usage("sys = starp(P, K, ny, nu)"); |
|
59 endif |
|
60 if (!is_struct(P)) |
|
61 error("---> P must be in system data structure"); |
|
62 endif |
|
63 if (!is_struct(K)) |
|
64 error("---> K must be in system data structure"); |
|
65 endif |
|
66 |
|
67 P = sysupdate(P, "ss"); |
|
68 [n, nz, mp, pp] = sysdimensions(P); |
|
69 np = n + nz; |
|
70 K = sysupdate(K, "ss"); |
|
71 [n, nz, mk, pk] = sysdimensions(K); |
|
72 nk = n + nz; |
|
73 ny_sign = 1; |
|
74 nu_sign = 1; |
|
75 if (nargin == 2) |
|
76 ## perform a LFT of P and K (upper or lower) |
|
77 ny = min([pp, mk]); |
|
78 nu = min([pk, mp]); |
|
79 else |
|
80 if (ny < 0) |
|
81 ny = -ny; |
|
82 ny_sign = -1; |
|
83 endif |
|
84 if (nu < 0) |
|
85 nu = -nu; |
|
86 nu_sign = -1; |
|
87 endif |
|
88 endif |
|
89 if (ny > pp) |
|
90 error("---> P has not enough outputs."); |
|
91 endif |
|
92 if (nu > mp) |
|
93 error("---> P has not enough inputs."); |
|
94 endif |
|
95 if (ny > mk) |
|
96 error("---> K has not enough inputs."); |
|
97 endif |
|
98 if (nu > pk) |
|
99 error("---> K has not enough outputs."); |
|
100 endif |
|
101 nwp = mp - nu; |
|
102 nzp = pp - ny; |
|
103 nwk = mk - ny; |
|
104 nzk = pk - nu; |
|
105 if ((nwp + nwk) < 1) |
|
106 error("---> no inputs left for star product."); |
|
107 endif |
|
108 if ((nzp + nzk) < 1) |
|
109 error("---> no outputs left for star product."); |
|
110 endif |
|
111 |
|
112 ## checks done, form sys |
|
113 if (nzp) Olst = [1:nzp]; endif |
|
114 if (nzk) Olst = [Olst, pp+nu+1:pp+pk]; endif |
|
115 if (nwp) Ilst = [1:nwp]; endif |
|
116 if (nwk) Ilst = [Ilst, mp+ny+1:mp+mk]; endif |
|
117 Clst = zeros(ny+nu,2); |
|
118 for ii = 1:nu |
|
119 Clst(ii,:) = [nwp+ii, nu_sign*(pp+ii)]; |
|
120 endfor |
|
121 for ii = 1:ny |
|
122 Clst(nu+ii,:) = [mp+ii, ny_sign*(nzp+ii)]; |
|
123 endfor |
|
124 sys = buildssic(Clst,[],Olst,Ilst,P,K); |
|
125 |
|
126 endfunction |