Mercurial > hg > octave-nkf
diff scripts/control/tzero.m @ 60:671f8bf989d8
[project @ 1993-08-13 21:03:40 by jwe]
Initial revision
author | jwe |
---|---|
date | Fri, 13 Aug 1993 21:03:40 +0000 |
parents | |
children | ca37b3c9d066 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/scripts/control/tzero.m @@ -0,0 +1,44 @@ +function zr = tzero (a, b, c, d, bal) + +# Compute the transmission zeros of a, b, c, d. +# +# bal = balancing option (see balance); default is "B". +# +# Needs to incorporate mvzero algorithm to isolate finite zeros. + + if (nargin == 4) + bal = "B"; + elseif (nargin ~= 5) + error("tzero: illegal number of arguments") + endif + + [n, m, p] = abcdchk (a, b, c, d); + + if(m != p) + + disp("warning: tzero: number of inputs,outputs differ -- squaring up") + + if (p > m) + disp (" by padding b, d with zeros") + b = [b, zeros (n, p-m)]; + d = [d, zeros (p, p-m)]; + m = p; + else + disp (" by padding c,d with zeros") + c = [c; zeros (m-p, n)]; + d = [d; zeros (m-p, m)]; + p = m; + endif + + disp ("This is a kludge. Try again with SISO system.") + + endif + + if (n != -1) + ab = [-a -b; c d]; + bb = [eye (n), zeros (n, m); zeros (p, n), zeros (p, m)]; + [ab, bb] = balance (ab, bb); + zr = qzval (ab, bb); + endif + +endfunction