From: <par...@us...> - 2010-09-26 00:02:51
|
Revision: 7772 http://octave.svn.sourceforge.net/octave/?rev=7772&view=rev Author: paramaniac Date: 2010-09-26 00:02:44 +0000 (Sun, 26 Sep 2010) Log Message: ----------- control: style fixes Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/feedback.m trunk/octave-forge/main/control/inst/@lti/issiso.m trunk/octave-forge/main/control/inst/@lti/series.m trunk/octave-forge/main/control/inst/@lti/sminreal.m trunk/octave-forge/main/control/inst/@tfpoly/__make_equally_long__.m trunk/octave-forge/main/control/inst/@tfpoly/minus.m trunk/octave-forge/main/control/inst/@tfpoly/mpower.m trunk/octave-forge/main/control/inst/@tfpoly/mtimes.m trunk/octave-forge/main/control/inst/@tfpoly/plus.m trunk/octave-forge/main/control/inst/@tfpoly/tfpoly.m trunk/octave-forge/main/control/inst/@tfpoly/uminus.m trunk/octave-forge/main/control/inst/@tfpoly/uplus.m Modified: trunk/octave-forge/main/control/inst/@lti/feedback.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/feedback.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@lti/feedback.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -126,6 +126,10 @@ for k = 1 : l_feedout M21(k, feedout(k)) = 1; endfor + + ## NOTE: for-loops do NOT the same as + ## M12(feedin, 1:l_feedin) = fbsign; + ## M21(1:l_feedout, feedout) = 1; M = [M11, M12; M21, M22]; Modified: trunk/octave-forge/main/control/inst/@lti/issiso.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/issiso.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@lti/issiso.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -30,8 +30,6 @@ print_usage (); endif - [p, m] = size (sys); + bool = all (size (sys) == 1); - bool = (p*m == 1); - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@lti/series.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/series.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@lti/series.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -97,6 +97,10 @@ out_scl(k, out1(k)) = 1; in_scl(in2(k), k) = 1; endfor + + ## NOTE: for-loop does NOT the same as + ## out_scl(1:l_out1, out1) = 1; + ## in_scl(in2, 1:l_out1) = 1; scl = in_scl * out_scl; Modified: trunk/octave-forge/main/control/inst/@lti/sminreal.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/sminreal.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@lti/sminreal.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -47,19 +47,19 @@ function sys = sminreal (sys, tol = 0) - if (nargin > 2) # sminreal () not possible (inside @lti) + if (nargin > 2) # sminreal () not possible (inside @lti) print_usage (); endif - if (! isa (sys, "ss")) # conversion done by dssdata + if (! isa (sys, "ss")) # conversion done by dssdata warning ("sminreal: system not in state-space form"); endif - if (! (is_real_scalar (tol) && (tol >= 0))) + if (! (is_real_scalar (tol) && tol >= 0)) error ("sminreal: second argument is not a valid tolerance"); endif - [a, b, c, d, e] = dssdata (sys); + [a, b, c, d, e] = dssdata (sys, []); a = abs (a) > tol; b = abs (b) > tol; @@ -82,12 +82,12 @@ function c_idx = __controllable_states__ (a, b) - n = rows (a); # number of states - a = a & ! eye (n); # set diagonal entries to zero + n = rows (a); # number of states + a = a & ! eye (n); # set diagonal entries to zero - c_vec = any (b, 2); # states directly controllable - c_idx = find (c_vec); # indices of directly controllable states - c_idx_new = 0; # any vector of length > 0 possible + c_vec = any (b, 2); # states directly controllable + c_idx = find (c_vec); # indices of directly controllable states + c_idx_new = 0; # any vector of length > 0 possible while (all (length (c_idx) != [0, n] && length(c_idx_new) != 0)) Modified: trunk/octave-forge/main/control/inst/@tfpoly/__make_equally_long__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/__make_equally_long__.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/__make_equally_long__.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -23,19 +23,13 @@ ## Created: September 2009 ## Version: 0.1 -function [peq1, peq2] = __make_equally_long__ (p1, p2) +function [a, b] = __make_equally_long__ (a, b) - lp1 = length (p1.poly); - lp2 = length (p2.poly); - lmax = max (lp1, lp2); + la = length (a.poly); + lb = length (b.poly); + lmax = max (la, lb); - leadzer1 = zeros (1, lmax - lp1); - leadzer2 = zeros (1, lmax - lp2); + a.poly = [zeros(1, lmax-la), a.poly]; + b.poly = [zeros(1, lmax-lb), b.poly]; - peq1 = p1; - peq2 = p2; - - peq1.poly = [leadzer1, p1.poly]; - peq2.poly = [leadzer2, p2.poly]; - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tfpoly/minus.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/minus.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/minus.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -22,7 +22,7 @@ ## Created: September 2009 ## Version: 0.1 -function p = minus (a, b) +function a = minus (a, b) if (! isa (a, "tfpoly")) a = tfpoly (a); @@ -34,10 +34,8 @@ [a, b] = __make_equally_long__ (a, b); - p = tfpoly (); + a.poly = a.poly - b.poly; - p.poly = a.poly - b.poly; + a = __remove_leading_zeros__ (a); - p = __remove_leading_zeros__ (p); - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tfpoly/mpower.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/mpower.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/mpower.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -24,14 +24,14 @@ function p = mpower (a, b) - if (! isa (b, "double") && ! isscalar (b)) + if (! isa (b, "double") && ! is_real_scalar (b)) error ("tfpoly: mpower: power must be a natural number"); endif - c = abs (round (b)); + c = uint64 (b); if (c != b) - error ("tfpoly: mpower: power must be a natural number"); + error ("tfpoly: mpower: power must be a positive integer"); endif if (c == 0) Modified: trunk/octave-forge/main/control/inst/@tfpoly/mtimes.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/mtimes.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/mtimes.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -22,7 +22,7 @@ ## Created: September 2009 ## Version: 0.1 -function p = mtimes (a, b) +function a = mtimes (a, b) if (! isa (a, "tfpoly")) a = tfpoly (a); @@ -32,8 +32,6 @@ b = tfpoly (b); endif - p = tfpoly (); + a.poly = conv (a.poly, b.poly); - p.poly = conv (a.poly, b.poly); - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tfpoly/plus.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/plus.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/plus.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -22,7 +22,7 @@ ## Created: September 2009 ## Version: 0.1 -function p = plus (a, b) +function a = plus (a, b) if (! isa (a, "tfpoly")) a = tfpoly (a); @@ -34,10 +34,8 @@ [a, b] = __make_equally_long__ (a, b); - p = tfpoly (); + a.poly = a.poly + b.poly; - p.poly = a.poly + b.poly; + a = __remove_leading_zeros__ (a); - p = __remove_leading_zeros__ (p); - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tfpoly/tfpoly.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/tfpoly.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/tfpoly.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -28,7 +28,7 @@ switch (nargin) case 0 - p.poly = []; + p = struct ("poly", []); p = class (p, "tfpoly"); case 1 Modified: trunk/octave-forge/main/control/inst/@tfpoly/uminus.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/uminus.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/uminus.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -22,10 +22,8 @@ ## Created: September 2009 ## Version: 0.1 -function p = uminus (a) +function a = uminus (a) - p = tfpoly (); + a.poly = -a.poly; - p.poly = -a.poly; - endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tfpoly/uplus.m =================================================================== --- trunk/octave-forge/main/control/inst/@tfpoly/uplus.m 2010-09-25 19:34:57 UTC (rev 7771) +++ trunk/octave-forge/main/control/inst/@tfpoly/uplus.m 2010-09-26 00:02:44 UTC (rev 7772) @@ -22,10 +22,8 @@ ## Created: September 2009 ## Version: 0.1 -function p = uplus (a) +function a = uplus (a) - p = tfpoly (); + a.poly = +a.poly; - p.poly = +a.poly; - endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |