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