Mercurial > octave-nkf
comparison scripts/control/system/buildssic.m @ 4771:b8105302cfe8
[project @ 2004-02-16 17:45:50 by jwe]
author | jwe |
---|---|
date | Mon, 16 Feb 2004 17:45:50 +0000 |
parents | 22bd65326ec1 |
children | bdbee5282954 |
comparison
equal
deleted
inserted
replaced
4770:ef5e598f099b | 4771:b8105302cfe8 |
---|---|
148 D_SYS = (nz > 0); | 148 D_SYS = (nz > 0); |
149 [A,B,C,D,tsam] = sys2ss(s1); | 149 [A,B,C,D,tsam] = sys2ss(s1); |
150 nt = n + nz; | 150 nt = n + nz; |
151 endif | 151 endif |
152 for ii = 6:nargin | 152 for ii = 6:nargin |
153 eval(["ss = s", num2str(ii-4), ";"]); | 153 eval(["mysys = s", num2str(ii-4), ";"]); |
154 if (!isstruct(ss)) | 154 if (!isstruct(mysys)) |
155 error("---> Parameter must be a structed system."); | 155 error("---> Parameter must be a structed system."); |
156 endif | 156 endif |
157 ss = sysupdate(ss, "ss"); | 157 mysys = sysupdate(mysys, "ss"); |
158 [n1, nz1, m1, p1] = sysdimensions(ss); | 158 [n1, nz1, m1, p1] = sysdimensions(mysys); |
159 if (n1 && nz1) | 159 if (n1 && nz1) |
160 error("---> cannot handle mixed continuous and discrete systems."); | 160 error("---> cannot handle mixed continuous and discrete systems."); |
161 endif | 161 endif |
162 if (D_SYS) | 162 if (D_SYS) |
163 if (n1) | 163 if (n1) |
164 error("---> cannot handle mixed cont. and discr. systems."); | 164 error("---> cannot handle mixed cont. and discr. systems."); |
165 endif | 165 endif |
166 if (tsam != sysgettsam(ss)) | 166 if (tsam != sysgettsam(mysys)) |
167 error("---> sampling time of all systems must match."); | 167 error("---> sampling time of all systems must match."); |
168 endif | 168 endif |
169 endif | 169 endif |
170 [as,bs,cs,ds] = sys2ss(ss); | 170 [as,bs,cs,ds] = sys2ss(mysys); |
171 nt1 = n1 + nz1; | 171 nt1 = n1 + nz1; |
172 if (!nt1) | 172 if (!nt1) |
173 ## pure gain (pad B, C with zeros) | 173 ## pure gain (pad B, C with zeros) |
174 B = [B, zeros(nt,m1)]; | 174 B = [B, zeros(nt,m1)]; |
175 C = [C; zeros(p1,nt)]; | 175 C = [C; zeros(p1,nt)]; |
293 endif | 293 endif |
294 Bnew(:,ii) = sign(iu)*B(:,abs(iu)); | 294 Bnew(:,ii) = sign(iu)*B(:,abs(iu)); |
295 Dnew(:,ii) = sign(iu)*D(:,abs(iu)); | 295 Dnew(:,ii) = sign(iu)*D(:,abs(iu)); |
296 endfor | 296 endfor |
297 | 297 |
298 sys = ss2sys(A, Bnew, C, Dnew, tsam, n, nz); | 298 sys = ss(A, Bnew, C, Dnew, tsam, n, nz); |
299 | 299 |
300 endfunction | 300 endfunction |