# HG changeset patch # User jwe # Date 1194539766 0 # Node ID ff0b965b65bc6f02e264886cce6d6ce3d7ae2d22 # Parent 1d0d7be2d0f882a2c57f57646b8a140c7aab4cd4 [project @ 2007-11-08 16:36:06 by jwe] diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/ChangeLog --- a/scripts/ChangeLog Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/ChangeLog Thu Nov 08 16:36:06 2007 +0000 @@ -12,12 +12,18 @@ * control/hinf/h2syn.m, control/hinf/hinf_ctr.m, control/hinf/hinfnorm.m, control/hinf/hinfsyn.m, control/hinf/hinfsyn_chk.m, control/hinf/is_dgkf.m, - control/hinf/wgt1o.m, control/util/__outlist__.m, - control/util/__zgpbal__.m, control/util/axis2dlim.m, - control/util/prompt.m, control/util/sortcom.m, - control/util/zgfmul.m, control/util/zgfslv.m, - control/util/zginit.m, control/util/zgreduce.m, - control/util/zgrownorm.m, control/util/zgscal.m: Style fixes. + control/hinf/wgt1o.m, control/obsolete/dezero.m, + control/obsolete/dlqg.m, control/obsolete/minfo.m, + control/obsolete/packsys.m, control/obsolete/qzval.m, + control/obsolete/rotg.m, control/obsolete/series.m, + control/obsolete/swapcols.m, control/obsolete/swaprows.m, + control/obsolete/syschnames.m, control/obsolete/unpacksys.m, + control/util/__outlist__.m, control/util/__zgpbal__.m, + control/util/axis2dlim.m, control/util/prompt.m, + control/util/sortcom.m, control/util/zgfmul.m, + control/util/zgfslv.m, control/util/zginit.m, + control/util/zgreduce.m, control/util/zgrownorm.m, + control/util/zgscal.m: Style fixes. 2007-11-08 David Bateman diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/control/obsolete/dezero.m --- a/scripts/control/obsolete/dezero.m Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/control/obsolete/dezero.m Thu Nov 08 16:36:06 2007 +0000 @@ -31,7 +31,7 @@ function t = dezero (s) ## delete the next line if you're stubbornly going to use dezero. - error("dezero is no longer supported."); + error ("dezero is no longer supported."); if (nargin != 1) print_usage (); @@ -48,7 +48,7 @@ ## need to remove zeros first, then call deblank s = toascii (s); - t = deblank(char(s(find(s != 0) ))); + t = deblank (char (s(find (s != 0)))); endif else diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/control/obsolete/dlqg.m --- a/scripts/control/obsolete/dlqg.m Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/control/obsolete/dlqg.m Thu Nov 08 16:36:06 2007 +0000 @@ -49,32 +49,32 @@ function [K, Q, P, Ee, Er] = dlqg (A, B, C, G, Sigw, Sigv, Q, R) - warning("dlqg: obsolete. use lqg instead (system data structure format)"); + warning ("dlqg: obsolete. use lqg instead (system data structure format)"); if (nargin == 5) ## system data structure format ## check that it really is system data structure - if(! isstruct(A) ) - error("dlqg: 5 arguments, first argument is not a system data structure structure") + if (! isstruct (A)) + error ("dlqg: 5 arguments, first argument is not a system data structure structure") endif - sys = sysupdate(sys,"ss"); # make sure in proper form - [ncstates,ndstates,nin,nout] = sysdimensions(sys); - if(ndstates == -1) - error("this message should never appear: bad system dimensions"); + sys = sysupdate (sys, "ss"); # make sure in proper form + [ncstates, ndstates, nin, nout] = sysdimensions (sys); + if (ndstates == -1) + error ("this message should never appear: bad system dimensions"); endif - if(ncstates) - error("dlqg: system has continuous-time states (try lqg?)") - elseif(ndstates < 1) - error("dlqg: system has no discrete time states") - elseif(nin <= columns(Sigw)) - error(["dlqg: ",num2str(nin)," inputs provided, noise dimension is ", ... - num2str(columns(Sigw))]) - elseif(nout != columns(Sigv)) - error(["dlqg: number of outputs (",num2str(nout),") incompatible with ", ... - "dimension of Sigv (",num2str(columns(Sigv)),")"]) + if (ncstates) + error ("dlqg: system has continuous-time states (try lqg?)") + elseif (ndstates < 1) + error ("dlqg: system has no discrete time states") + elseif (nin <= columns (Sigw)) + error ("dlqg: %d inputs provided, noise dimension is %d", + nin, columns (Sigw)); + elseif (nout != columns(Sigv)) + error ("dlqg: number of outputs (%d) incompatible with dimension of Sigv (%d)", + nout, columns (Sigv)); endif ## put parameters into correct variables @@ -82,8 +82,8 @@ Q = G; Sigv = C; Sigw = B; - [A,B,C,D] = sys2ss(Sys) - [n,m] = size(B) + [A, B, C, D] = sys2ss (Sys) + [n, m] = size (B) m1 = columns(Sigw); m2 = m1+1; G = B(:,1:m1); @@ -91,35 +91,35 @@ elseif (nargin == 8) ## state-space format - m = columns(B); - m1 = columns(G); - p = rows(C); - n = abcddim(A,B,C,zeros(p,m)); - n1 = abcddim(A,G,C,zeros(p,m1)); - if( (n == -1) || (n1 == -1)) - error("dlqg: A,B,C,G incompatibly dimensioned"); - elseif(p != columns(Sigv)) - error("dlqg: C, Sigv incompatibly dimensioned"); - elseif(m1 != columns(Sigw)) - error("dlqg: G, Sigw incompatibly dimensioned"); + m = columns (B); + m1 = columns (G); + p = rows (C); + n = abcddim (A, B, C, zeros (p, m)); + n1 = abcddim (A, G, C, zeros (p, m1)); + if (n == -1 || n1 == -1) + error ("dlqg: A,B,C,G incompatibly dimensioned"); + elseif (p != columns (Sigv)) + error ("dlqg: C, Sigv incompatibly dimensioned"); + elseif (m1 != columns (Sigw)) + error ("dlqg: G, Sigw incompatibly dimensioned"); endif else error ("dlqg: invalid number of arguments") endif - if (! (issquare(Sigw) && issquare(Sigv) ) ) - error("dlqg: Sigw, Sigv must be square"); + if (! (issquare (Sigw) && issquare (Sigv))) + error ("dlqg: Sigw, Sigv must be square"); endif ## now we can just do the design; call dlqr and dlqe, since all matrices ## are not given in Cholesky factor form (as in h2syn case) - [Ks, P, Er] = dlqr(A,B,Q,R); - [Ke, Q, jnk, Ee] = dlqe(A,G,C,Sigw,Sigv); + [Ks, P, Er] = dlqr (A, B, Q, R); + [Ke, Q, jnk, Ee] = dlqe (A, G, C, Sigw, Sigv); Ac = A - Ke*C - B*Ks; Bc = Ke; Cc = -Ks; - Dc = zeros(rows(Cc),columns(Bc)); - K = ss(Ac,Bc,Cc,Dc,1); - disp("HODEL: need to add names to this guy!") + Dc = zeros (rows(Cc), columns(Bc)); + K = ss (Ac, Bc, Cc, Dc, 1); + disp ("HODEL: need to add names to this guy!") endfunction diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/control/obsolete/minfo.m --- a/scripts/control/obsolete/minfo.m Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/control/obsolete/minfo.m Thu Nov 08 16:36:06 2007 +0000 @@ -44,17 +44,17 @@ function [systype, nout, nin, ncstates, ndstates] = minfo (inmat) - warning("minfo: obsolete. Use sys2ss, sys2tf, or sys2zp."); + warning ("minfo: obsolete. Use sys2ss, sys2tf, or sys2zp."); - if (nargin ~= 1 ) + if (nargin != 1 ) disp ("MINFO: Wrong number of arguments") systype = nout = nin = ncstates = ndstates = []; endif - [rr,cc] = size(inmat); + [rr, cc] = size (inmat); ## Check for empty matrix first! - if (isempty(inmat)) + if (isempty (inmat)) systype = "empty"; nout = nin = ncstates = ndstates = 0; return @@ -91,4 +91,5 @@ ncstates = 0; ndstates = 0; endif + endfunction diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/control/obsolete/packsys.m --- a/scripts/control/obsolete/packsys.m Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/control/obsolete/packsys.m Thu Nov 08 16:36:06 2007 +0000 @@ -38,17 +38,16 @@ warning("packsys is obsolete! Use ss instead."); if (nargin < 3 || nargin > 5) - disp("packsys: Invalid number of arguments") + disp ("packsys: Invalid number of arguments"); endif ## check dflg - if(nargin == 5) - if( !isscalar(dflg)) - [m,n] = size(dflg); - error(["packsys: dflg (",num2str(m),",",num2str(n), ... - ") must be a scalar."]); - elseif( (dflg != 0) && (dflg != 1)) - error(["packsys: dflg=",num2str(dflg),"must be 0 or 1"]); + if (nargin == 5) + if (! isscalar (dflg)) + [m, n] = size(dflg); + error (["packsys: dflg (%d,%d) must be a scalar", m, n); + elseif (dflg != 0 && dflg != 1) + error ("packsys: dflg=%g must be 0 or 1", dflg); endif else ## default condition @@ -57,16 +56,16 @@ if (nargin == 3) ## No D matrix. Form a zero one! - [brows,bcols] = size(b); - [crows,ccols] = size(c); - d = zeros(crows,bcols); + [brows, bcols] = size (b); + [crows, ccols] = size (c); + d = zeros (crows, bcols); endif - [n,m,p] = abcddim(a,b,c,d); + [n, m, p] = abcddim (a, b, c, d); if (n == -1 || m == -1 || p == -1) - error("packsys: incompatible dimensions") + error ("packsys: incompatible dimensions") endif - Asys = ss(a,b,c,d,dflg); + Asys = ss (a, b, c, d, dflg); endfunction diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/control/obsolete/qzval.m --- a/scripts/control/obsolete/qzval.m Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/control/obsolete/qzval.m Thu Nov 08 16:36:06 2007 +0000 @@ -41,7 +41,7 @@ function lam = qzval (A, B) - warning("qzval is obsolete; calling qz instead") - lam = qz(A,B); + warning ("qzval is obsolete; calling qz instead") + lam = qz (A, B); endfunction diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/control/obsolete/rotg.m --- a/scripts/control/obsolete/rotg.m Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/control/obsolete/rotg.m Thu Nov 08 16:36:06 2007 +0000 @@ -24,6 +24,6 @@ function [c, s] = rotg (a, b) - [c,s] = givens(a,b); + [c, s] = givens (a, b); endfunction diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/control/obsolete/series.m --- a/scripts/control/obsolete/series.m Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/control/obsolete/series.m Thu Nov 08 16:36:06 2007 +0000 @@ -43,56 +43,56 @@ ## If two arguments input, take care of mu system case - warning("series is superseded by sysmult; use sysmult instead.") + warning ("series is superseded by sysmult; use sysmult instead.") muflag = 0; - if(nargin == 2) - temp=b1; - [a1,b1,c1,d1]=sys2ss(a1); - [a2,b2,c2,d2]=sys2ss(temp); + if (nargin == 2) + temp = b1; + [a1, b1, c1, d1] = sys2ss (a1); + [a2, b2, c2, d2] = sys2ss (temp); muflag = 1; endif ## If four arguments input, put two transfer functions in series - if(nargin == 4) - a = conv(a1,c1); % was conv1 - b = conv(b1,d1); % was conv1 + if (nargin == 4) + a = conv (a1, c1); # was conv1 + b = conv (b1, d1); # was conv1 c = 0; d = 0; ## Find series combination of 2 state space systems - elseif((nargin == 8)||(muflag == 1)) + elseif (nargin == 8 || muflag == 1) ## check matrix dimensions - [n1,m1,p1] = abcddim(a1,b1,c1,d1); - [n2,m2,p2] = abcddim(a2,b2,c2,d2); + [n1, m1, p1] = abcddim (a1, b1, c1, d1); + [n2, m2, p2] = abcddim (a2, b2, c2, d2); - if((n1 == -1) || (n2 == -1)) - error("Incorrect matrix dimensions"); + if (n1 == -1 || n2 == -1) + error ("incorrect matrix dimensions"); endif ## check to make sure the number of outputs of system1 equals the number ## of inputs of system2 - if(p1 ~= m2) - error("System 1 output / System 2 input connection sizes do not match"); + if(p1 != m2) + error ("system 1 output / system 2 input connection sizes do not match"); endif ## put the two state space systems in series - a = [a1, zeros(rows(a1),columns(a2));b2*c1, a2]; - b = [b1;b2*d1]; + a = [a1, zeros(rows(a1), columns(a2)); b2*c1, a2]; + b = [b1; b2*d1]; c = [d2*c1, c2]; d = [d2*d1]; ## take care of mu output - if(muflag == 1) - a=ss(a,b,c,d); - b=c=d=0; + if (muflag == 1) + a = ss (a, b, c, d); + b = c = d = 0; endif endif diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/control/obsolete/swapcols.m --- a/scripts/control/obsolete/swapcols.m Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/control/obsolete/swapcols.m Thu Nov 08 16:36:06 2007 +0000 @@ -31,7 +31,7 @@ function B = swapcols (A) - m = length(A(1,:)); + m = length (A(1,:)); idx = m:-1:1; B = A(:,idx); diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/control/obsolete/swaprows.m --- a/scripts/control/obsolete/swaprows.m Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/control/obsolete/swaprows.m Thu Nov 08 16:36:06 2007 +0000 @@ -31,7 +31,7 @@ function B = swaprows (A) - m = rows(A); + m = rows (A); idx = m:-1:1; B = A(idx,:); diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/control/obsolete/syschnames.m --- a/scripts/control/obsolete/syschnames.m Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/control/obsolete/syschnames.m Thu Nov 08 16:36:06 2007 +0000 @@ -28,6 +28,6 @@ function retsys = syschnames (sys, opt, list, names) - retsys = syssetsignals(sys,opt,names,list); + retsys = syssetsignals (sys, opt, names, list); endfunction diff -r 1d0d7be2d0f8 -r ff0b965b65bc scripts/control/obsolete/unpacksys.m --- a/scripts/control/obsolete/unpacksys.m Thu Nov 08 16:25:44 2007 +0000 +++ b/scripts/control/obsolete/unpacksys.m Thu Nov 08 16:36:06 2007 +0000 @@ -25,8 +25,8 @@ function [a, b, c, d] = unpacksys (syst) - warning("unpacksys obsolete; calling sys2ss"); - [a,b,c,d] = sys2ss(syst); + warning ("unpacksys obsolete; calling sys2ss"); + [a, b, c, d] = sys2ss (syst); endfunction