annotate scripts/control/system/starp.m @ 5307:4c8a2e4e0717

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