annotate scripts/control/tzero2.m @ 3381:69b167451491

[project @ 1999-12-15 20:48:10 by jwe]
author jwe
date Wed, 15 Dec 1999 20:48:45 +0000
parents 8dd4718801fd
children 1a8e2c0d627a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3381
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
1 ## Copyright (C) 1993 Auburn University. All Rights Reserved
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
2 ##
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
3 ## This file is part of Octave.
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
4 ##
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
6 ## under the terms of the GNU General Public License as published by the
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
7 ## Free Software Foundation; either version 2, or (at your option) any
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
8 ## later version.
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
9 ##
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but WITHOUT
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
11 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
12 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
13 ## for more details.
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
14 ##
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
15 ## You should have received a copy of the GNU General Public License
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
16 ## along with Octave; see the file COPYING. If not, write to the Free
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
17 ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
3213
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
18
3346
8dd4718801fd [project @ 1999-11-09 18:18:12 by jwe]
jwe
parents: 3284
diff changeset
19 ## -*- texinfo -*-
8dd4718801fd [project @ 1999-11-09 18:18:12 by jwe]
jwe
parents: 3284
diff changeset
20 ##@deftypefn {Function File } { @var{zr} =} tzero2 (@var{a}, @var{b}, @var{c}, @var{d}, @var{bal})
8dd4718801fd [project @ 1999-11-09 18:18:12 by jwe]
jwe
parents: 3284
diff changeset
21 ##Compute the transmission zeros of a, b, c, d.
8dd4718801fd [project @ 1999-11-09 18:18:12 by jwe]
jwe
parents: 3284
diff changeset
22 ##
8dd4718801fd [project @ 1999-11-09 18:18:12 by jwe]
jwe
parents: 3284
diff changeset
23 ##bal = balancing option (see balance); default is "B".
8dd4718801fd [project @ 1999-11-09 18:18:12 by jwe]
jwe
parents: 3284
diff changeset
24 ##
8dd4718801fd [project @ 1999-11-09 18:18:12 by jwe]
jwe
parents: 3284
diff changeset
25 ##Needs to incorporate @code{mvzero} algorithm to isolate finite zeros; use
8dd4718801fd [project @ 1999-11-09 18:18:12 by jwe]
jwe
parents: 3284
diff changeset
26 ##@code{tzero} instead.
8dd4718801fd [project @ 1999-11-09 18:18:12 by jwe]
jwe
parents: 3284
diff changeset
27 ##@end deftypefn
3213
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
28
3346
8dd4718801fd [project @ 1999-11-09 18:18:12 by jwe]
jwe
parents: 3284
diff changeset
29 function zr = tzero2 (a, b, c, d, bal)
3381
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3346
diff changeset
30 ## Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
3213
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
31
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
32 if (nargin == 4)
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
33 bal = "B";
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
34 elseif (nargin != 5)
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
35 error ("tzero: illegal number of arguments");
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
36 endif
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
37
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
38 [n, m, p] = abcddim (a, b, c, d);
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
39
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
40 if (n > 0 && m > 0 && p > 0)
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
41 if (m != p)
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
42 fprintf (stderr, "tzero: number of inputs,outputs differ. squaring up");
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
43 if (p > m)
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
44 fprintf (stderr, " by padding b and d with zeros.");
3279
6dd06d525de6 [project @ 1999-10-12 16:52:40 by jwe]
jwe
parents: 3236
diff changeset
45 b = [b, (zeros (n, p-m))];
6dd06d525de6 [project @ 1999-10-12 16:52:40 by jwe]
jwe
parents: 3236
diff changeset
46 d = [d, (zeros (p, p-m))];
3213
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
47 m = p;
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
48 else
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
49 fprintf (stderr, " by padding c and d with zeros.");
3279
6dd06d525de6 [project @ 1999-10-12 16:52:40 by jwe]
jwe
parents: 3236
diff changeset
50 c = [c; (zeros (m-p, n))];
6dd06d525de6 [project @ 1999-10-12 16:52:40 by jwe]
jwe
parents: 3236
diff changeset
51 d = [d; (zeros (m-p, m))];
3213
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
52 p = m;
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
53 endif
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
54 fprintf (stderr, "This is a kludge. Try again with SISO system.");
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
55 endif
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
56 ab = [-a, -b; c, d];
3279
6dd06d525de6 [project @ 1999-10-12 16:52:40 by jwe]
jwe
parents: 3236
diff changeset
57 bb = [(eye (n)), (zeros (n, m)); (zeros (p, n)), (zeros (p, m))];
3213
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
58 [ab,bb] = balance (ab, bb);
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
59 zr = -qz (ab, bb);
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
60 else
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
61 error ("tzero: a, b, c, d not compatible. exiting");
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
62 endif
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
63
ba1c7cdc6090 [project @ 1998-11-06 16:15:36 by jwe]
jwe
parents:
diff changeset
64 endfunction