# HG changeset patch # User jwe # Date 745275820 0 # Node ID 671f8bf989d8dcda13ebdc9147b1415e05b91869 # Parent 2d10ab3ee69d61a1bc1bd3f5813d864721ba2905 [project @ 1993-08-13 21:03:40 by jwe] Initial revision diff -r 2d10ab3ee69d -r 671f8bf989d8 scripts/control/abcddim.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/control/abcddim.m Fri Aug 13 21:03:40 1993 +0000 @@ -0,0 +1,55 @@ +function [n, m, p] = abcdchk (a, b, c, d) + +# Usage: [n, m, p] = abcdchk (a, b, c, d) +# +# Check for compatibility of the dimensions of the matrices defining +# the linear system (a, b, c, d). +# +# returns n = number of system states, +# m = number of system inputs +# p = number of system outputs +# +# returns n = m = p = -1 if system is not compatible + + if (nargin != 4) + error ("abcdchk: illegal number of arguments. Need four.") + endif + + n = -1; + m = -1; + p = -1; + + [an, am] = size (a); + if (an != am) + disp ("abcdchk: a is not square"); + return; + endif + + [bn, bm] = size (b); + if (bn != am) + disp ("abcdchk: a, b are not compatible"); + return; + endif + + [cn, cm] = size (c); + if (cm != an) + disp ("abcdchk: a, c are not compatible"); + return; + endif + + [dn, dm] = size (d); + if (cn != dn) + disp ("abcdchk: c, d are not compatible"); + return; + endif + + if (bm != dm) + disp ("abcdchk: b, d are not compatible"); + return; + endif + + n = an; + m = bm; + p = cn; + +endfunction diff -r 2d10ab3ee69d -r 671f8bf989d8 scripts/control/tzero.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/control/tzero.m Fri Aug 13 21:03:40 1993 +0000 @@ -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