annotate scripts/control/system/starp.m @ 3500:7923abdeb4e5

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