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 -*- |
3882
|
20 ## @deftypefn {Function File} {} starp (@var{P}, @var{K}, @var{ny}, @var{nu}) |
3433
|
21 ## @format |
|
22 ## |
|
23 ## Redheffer star product or upper/lower LFT, respectively. |
|
24 ## |
|
25 ## |
|
26 ## +-------+ |
|
27 ## --------->| |---------> |
|
28 ## | P | |
|
29 ## +--->| |---+ ny |
|
30 ## | +-------+ | |
|
31 ## +-------------------+ |
|
32 ## | | |
|
33 ## +----------------+ | |
|
34 ## | | |
|
35 ## | +-------+ | |
|
36 ## +--->| |------+ nu |
|
37 ## | K | |
|
38 ## --------->| |---------> |
|
39 ## +-------+ |
|
40 ## |
|
41 ## If ny and nu "consume" all inputs and outputs of K then the result |
|
42 ## is a lower fractional transformation. If ny and nu "consume" all |
|
43 ## inputs and outputs of P then the result is an upper fractional |
|
44 ## transformation. |
|
45 ## |
|
46 ## ny and/or nu may be negative (= negative feedback) |
|
47 ## @end format |
|
48 ## @end deftypefn |
|
49 |
|
50 ## Author: Kai P. Mueller <mueller@ifr.ing.tu-bs.de> |
|
51 ## Created: May 1998 |
|
52 |
|
53 function sys = starp (P, K, ny, nu); |
|
54 |
|
55 if((nargin != 2) && (nargin != 4)) |
|
56 usage("sys = starp(P, K, ny, nu)"); |
|
57 endif |
|
58 if (!is_struct(P)) |
|
59 error("---> P must be in system data structure"); |
|
60 endif |
|
61 if (!is_struct(K)) |
|
62 error("---> K must be in system data structure"); |
|
63 endif |
|
64 |
|
65 P = sysupdate(P, "ss"); |
|
66 [n, nz, mp, pp] = sysdimensions(P); |
|
67 np = n + nz; |
|
68 K = sysupdate(K, "ss"); |
|
69 [n, nz, mk, pk] = sysdimensions(K); |
|
70 nk = n + nz; |
|
71 ny_sign = 1; |
|
72 nu_sign = 1; |
|
73 if (nargin == 2) |
|
74 ## perform a LFT of P and K (upper or lower) |
|
75 ny = min([pp, mk]); |
|
76 nu = min([pk, mp]); |
|
77 else |
|
78 if (ny < 0) |
|
79 ny = -ny; |
|
80 ny_sign = -1; |
|
81 endif |
|
82 if (nu < 0) |
|
83 nu = -nu; |
|
84 nu_sign = -1; |
|
85 endif |
|
86 endif |
|
87 if (ny > pp) |
|
88 error("---> P has not enough outputs."); |
|
89 endif |
|
90 if (nu > mp) |
|
91 error("---> P has not enough inputs."); |
|
92 endif |
|
93 if (ny > mk) |
|
94 error("---> K has not enough inputs."); |
|
95 endif |
|
96 if (nu > pk) |
|
97 error("---> K has not enough outputs."); |
|
98 endif |
|
99 nwp = mp - nu; |
|
100 nzp = pp - ny; |
|
101 nwk = mk - ny; |
|
102 nzk = pk - nu; |
|
103 if ((nwp + nwk) < 1) |
|
104 error("---> no inputs left for star product."); |
|
105 endif |
|
106 if ((nzp + nzk) < 1) |
|
107 error("---> no outputs left for star product."); |
|
108 endif |
|
109 |
|
110 ## checks done, form sys |
|
111 if (nzp) Olst = [1:nzp]; endif |
|
112 if (nzk) Olst = [Olst, pp+nu+1:pp+pk]; endif |
|
113 if (nwp) Ilst = [1:nwp]; endif |
|
114 if (nwk) Ilst = [Ilst, mp+ny+1:mp+mk]; endif |
|
115 Clst = zeros(ny+nu,2); |
|
116 for ii = 1:nu |
|
117 Clst(ii,:) = [nwp+ii, nu_sign*(pp+ii)]; |
|
118 endfor |
|
119 for ii = 1:ny |
|
120 Clst(nu+ii,:) = [mp+ii, ny_sign*(nzp+ii)]; |
|
121 endfor |
|
122 sys = buildssic(Clst,[],Olst,Ilst,P,K); |
|
123 |
|
124 endfunction |