2847
|
1 ## Copyright (C) 1996, 1997 John W. Eaton |
2313
|
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 |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License 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 |
|
18 ## 02111-1307, USA. |
245
|
19 |
2311
|
20 ## Usage: zr = tzero (a, b, c, d, bal) |
|
21 ## |
|
22 ## Compute the transmission zeros of a, b, c, d. |
|
23 ## |
|
24 ## bal = balancing option (see balance); default is "B". |
|
25 ## |
|
26 ## Needs to incorporate mvzero algorithm to isolate finite zeros. |
60
|
27 |
2312
|
28 ## Author: A. S. Hodel <scotte@eng.auburn.edu> |
|
29 ## Created: August 1993 |
|
30 ## Adapted-By: jwe |
60
|
31 |
2312
|
32 function zr = tzero (a, b, c, d, bal) |
71
|
33 |
60
|
34 if (nargin == 4) |
|
35 bal = "B"; |
73
|
36 elseif (nargin != 5) |
904
|
37 error ("tzero: invalid number of arguments"); |
60
|
38 endif |
|
39 |
73
|
40 [n, m, p] = abcddim (a, b, c, d); |
60
|
41 |
73
|
42 if (n > 0 && m > 0 && p > 0) |
|
43 if (m != p) |
904
|
44 warning ("tzero: number of inputs,outputs differ. squaring up"); |
73
|
45 if (p > m) |
904
|
46 warning (" by padding b and d with zeros."); |
1337
|
47 b = [b, (zeros (n, p-m))]; |
|
48 d = [d, (zeros (p, p-m))]; |
73
|
49 m = p; |
|
50 else |
904
|
51 warning (" by padding c and d with zeros."); |
1337
|
52 c = [c; (zeros (m-p, n))]; |
|
53 d = [d; (zeros (m-p, m))]; |
73
|
54 p = m; |
|
55 endif |
904
|
56 warning ("This is a kludge. Try again with SISO system."); |
60
|
57 endif |
73
|
58 ab = [-a, -b; c, d]; |
1337
|
59 bb = [(eye (n)), (zeros (n, m)); (zeros (p, n)), (zeros (p, m))]; |
|
60 [ab, bb] = balance (ab, bb); |
73
|
61 zr = -qzval (ab, bb); |
|
62 else |
904
|
63 error ("tzero: a, b, c, d not compatible"); |
60
|
64 endif |
|
65 |
|
66 endfunction |