3381
|
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. |
3213
|
18 |
|
19 function [a,b,c,d] = series(a1,b1,c1,d1,a2,b2,c2,d2) |
3381
|
20 ## Forms the series connection of two systems. |
|
21 ## |
|
22 ## Superseded by sysmult. Do not use this routine! |
|
23 ## used internally in zp2ss |
|
24 ## |
|
25 ## Type of input: Transfer functions |
|
26 ## Command: [num,den]=series(num1,den1,num2,den2) |
|
27 ## Forms the series representation of the two transfer functions. |
|
28 ## |
|
29 ## Type of input: State space systems |
|
30 ## Command: [a,b,c,d]=series(a1,b1,c1,d1,a2,b2,c2,d2) |
|
31 ## Forms the series representation of the two state space system arguments. |
|
32 ## The series connected system will have the inputs of system 1 and the |
|
33 ## outputs of system 2. |
|
34 ## |
|
35 ## Type of input: system data structure |
|
36 ## Command: syst=series(syst1,syst2) |
|
37 ## Forms the series representation of the two mu system arguments. |
|
38 ## Written by David Clem August 15, 1994 |
3213
|
39 |
3381
|
40 ## If two arguments input, take care of mu system case |
3213
|
41 |
|
42 warning("series is superseded by sysmult; use sysmult instead.") |
|
43 |
|
44 muflag = 0; |
|
45 if(nargin == 2) |
|
46 temp=b1; |
|
47 [a1,b1,c1,d1]=sys2ss(a1); |
|
48 [a2,b2,c2,d2]=sys2ss(temp); |
|
49 muflag = 1; |
|
50 endif |
|
51 |
3381
|
52 ## If four arguments input, put two transfer functions in series |
3213
|
53 |
|
54 if(nargin == 4) |
|
55 a = conv(a1,c1); % was conv1 |
|
56 b = conv(b1,d1); % was conv1 |
|
57 c = 0; |
|
58 d = 0; |
|
59 |
3381
|
60 ## Find series combination of 2 state space systems |
3213
|
61 |
|
62 elseif((nargin == 8)||(muflag == 1)) |
|
63 |
3381
|
64 ## check matrix dimensions |
3213
|
65 |
|
66 [n1,m1,p1] = abcddim(a1,b1,c1,d1); |
|
67 [n2,m2,p2] = abcddim(a2,b2,c2,d2); |
|
68 |
|
69 if((n1 == -1) || (n2 == -1)) |
|
70 error("Incorrect matrix dimensions"); |
|
71 endif |
|
72 |
3381
|
73 ## check to make sure the number of outputs of system1 equals the number |
|
74 ## of inputs of system2 |
3213
|
75 |
|
76 if(p1 ~= m2) |
|
77 error("System 1 output / System 2 input connection sizes do not match"); |
|
78 endif |
|
79 |
3381
|
80 ## put the two state space systems in series |
3213
|
81 |
3238
|
82 a = [a1, zeros(rows(a1),columns(a2));b2*c1, a2]; |
3213
|
83 b = [b1;b2*d1]; |
3238
|
84 c = [d2*c1, c2]; |
3213
|
85 d = [d2*d1]; |
|
86 |
3381
|
87 ## take care of mu output |
3213
|
88 |
|
89 if(muflag == 1) |
|
90 a=ss2sys(a,b,c,d); |
|
91 b=c=d=0; |
|
92 endif |
|
93 endif |
|
94 |
|
95 endfunction |
|
96 |