3430
|
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 |
5307
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301 USA. |
3430
|
19 |
3439
|
20 ## -*- texinfo -*- |
5016
|
21 ## @deftypefn {Function File} {@var{ksys} =} parallel (@var{asys}, @var{bsys}) |
3430
|
22 ## Forms the parallel connection of two systems. |
|
23 ## |
5016
|
24 ## @example |
|
25 ## @group |
|
26 ## -------------------- |
|
27 ## | -------- | |
3502
|
28 ## u ----->|----> | asys |--->|----> y1 |
3430
|
29 ## | | -------- | |
5016
|
30 ## | | -------- | |
3502
|
31 ## |--->|----> | bsys |--->|----> y2 |
3430
|
32 ## | -------- | |
|
33 ## -------------------- |
3502
|
34 ## ksys |
5016
|
35 ## @end group |
|
36 ## @end example |
3439
|
37 ## @end deftypefn |
3430
|
38 |
|
39 ## Author: David Clem |
|
40 ## Created: August 15, 1994 |
|
41 ## completely rewritten Oct 1996 a s hodel |
|
42 ## SYS_INTERNAL accesses members of system structure |
|
43 |
|
44 function sysp = parallel (Asys, Bsys) |
|
45 |
|
46 if(nargin != 2) |
|
47 usage("sysp = parallel(Asys,Bsys)"); |
|
48 endif |
4030
|
49 if(! isstruct(Asys) ) |
3430
|
50 error("1st input argument is not a system data structure") |
4030
|
51 elseif (! isstruct(Bsys) ) |
3430
|
52 error("2nd input argument is not a system data structure") |
|
53 endif |
|
54 [Ann,Anz,mA] = sysdimensions(Asys); |
|
55 [Bnn,Bnz,mB] = sysdimensions(Bsys); |
|
56 if(mA != mB) |
|
57 error(["Asys has ",num2str(mA)," inputs, Bsys has ",num2str(mB)," inputs"]); |
|
58 endif |
|
59 |
|
60 ## save signal names |
|
61 Ain = sysgetsignals(Asys,"in"); |
|
62 |
|
63 ## change signal names to avoid warning messages from sysgroup |
3438
|
64 Asys = syssetsignals(Asys,"in",__sysdefioname__(length(Ain),"Ain_u")); |
|
65 Bsys = syssetsignals(Bsys,"in",__sysdefioname__(length(Ain),"Bin_u")); |
3430
|
66 |
|
67 sysp = sysgroup(Asys,Bsys); |
4771
|
68 sysD = ss([],[],[],[eye(mA);eye(mA)]); |
3430
|
69 |
|
70 sysp = sysmult(sysp,sysD); |
|
71 sysp = syssetsignals(sysp,"in",Ain); |
|
72 |
|
73 endfunction |