Mercurial > octave-nkf
comparison scripts/control/tzero.m @ 73:f3c9042fd609
[project @ 1993-08-30 14:49:08 by jwe]
author | jwe |
---|---|
date | Mon, 30 Aug 1993 14:54:55 +0000 |
parents | ca37b3c9d066 |
children | 16a24e76d6e0 |
comparison
equal
deleted
inserted
replaced
72:2d480148756b | 73:f3c9042fd609 |
---|---|
6 # | 6 # |
7 # bal = balancing option (see balance); default is "B". | 7 # bal = balancing option (see balance); default is "B". |
8 # | 8 # |
9 # Needs to incorporate mvzero algorithm to isolate finite zeros. | 9 # Needs to incorporate mvzero algorithm to isolate finite zeros. |
10 | 10 |
11 # Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993 | 11 # Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993. |
12 | 12 |
13 if (nargin == 4) | 13 if (nargin == 4) |
14 bal = "B"; | 14 bal = "B"; |
15 elseif (nargin ~= 5) | 15 elseif (nargin != 5) |
16 error("tzero: illegal number of arguments") | 16 error ("tzero: illegal number of arguments"); |
17 endif | 17 endif |
18 | 18 |
19 [n, m, p] = abcdchk (a, b, c, d); | 19 [n, m, p] = abcddim (a, b, c, d); |
20 | 20 |
21 if(m != p) | 21 if (n > 0 && m > 0 && p > 0) |
22 | 22 if (m != p) |
23 disp("warning: tzero: number of inputs,outputs differ -- squaring up") | 23 fprintf (stderr "tzero: number of inputs,outputs differ. squaring up"); |
24 | 24 if (p > m) |
25 if (p > m) | 25 fprintf (stderr, " by padding b and d with zeros."); |
26 disp (" by padding b, d with zeros") | 26 b = [b, zeros (n, p-m)]; |
27 b = [b, zeros (n, p-m)]; | 27 d = [d, zeros (p, p-m)]; |
28 d = [d, zeros (p, p-m)]; | 28 m = p; |
29 m = p; | 29 else |
30 else | 30 fprintf (stderr, " by padding c and d with zeros."); |
31 disp (" by padding c,d with zeros") | 31 c = [c; zeros (m-p, n)]; |
32 c = [c; zeros (m-p, n)]; | 32 d = [d; zeros (m-p, m)]; |
33 d = [d; zeros (m-p, m)]; | 33 p = m; |
34 p = m; | 34 endif |
35 fprintf (stderr, "This is a kludge. Try again with SISO system."); | |
35 endif | 36 endif |
36 | 37 ab = [-a, -b; c, d]; |
37 disp ("This is a kludge. Try again with SISO system.") | |
38 | |
39 endif | |
40 | |
41 if (n != -1) | |
42 ab = [-a -b; c d]; | |
43 bb = [eye (n), zeros (n, m); zeros (p, n), zeros (p, m)]; | 38 bb = [eye (n), zeros (n, m); zeros (p, n), zeros (p, m)]; |
44 [ab, bb] = balance (ab, bb); | 39 [ab,bb] = balance (ab, bb); |
45 zr = qzval (ab, bb); | 40 zr = -qzval (ab, bb); |
41 else | |
42 error ("tzero: a, b, c, d not compatible. exiting"); | |
46 endif | 43 endif |
47 | 44 |
48 endfunction | 45 endfunction |