From: <par...@us...> - 2011-09-18 07:27:47
|
Revision: 8549 http://octave.svn.sourceforge.net/octave/?rev=8549&view=rev Author: paramaniac Date: 2011-09-18 07:27:40 +0000 (Sun, 18 Sep 2011) Log Message: ----------- control: add more comments to constructors Modified Paths: -------------- trunk/octave-forge/main/control/inst/@frd/frd.m trunk/octave-forge/main/control/inst/@ss/ss.m trunk/octave-forge/main/control/inst/@tf/tf.m Modified: trunk/octave-forge/main/control/inst/@frd/frd.m =================================================================== --- trunk/octave-forge/main/control/inst/@frd/frd.m 2011-09-17 05:34:35 UTC (rev 8548) +++ trunk/octave-forge/main/control/inst/@frd/frd.m 2011-09-18 07:27:40 UTC (rev 8549) @@ -100,7 +100,7 @@ otherwise # default case argc = numel (varargin); # number of additional arguments after H and w if (issample (varargin{1}, -10)) # sys = frd (H, w, tsam, "prop1", val1, ...) - tsam = varargin{1}; # discrete-time + tsam = varargin{1}; # sampling time, could be 0 as well argc--; # tsam is not a property-value pair if (argc > 0) # if there are any properties and values ... varargin = varargin(2:end); # remove tsam from property-value list @@ -111,7 +111,7 @@ endswitch [H, w] = __adjust_frd_data__ (H, w); - [p, m] = __frd_dim__ (H, w); + [p, m] = __frd_dim__ (H, w); # determine number of outputs and inputs frdata = struct ("H", H, "w", w); # struct for frd-specific data ltisys = lti (p, m, tsam); # parent class for general lti data Modified: trunk/octave-forge/main/control/inst/@ss/ss.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/ss.m 2011-09-17 05:34:35 UTC (rev 8548) +++ trunk/octave-forge/main/control/inst/@ss/ss.m 2011-09-18 07:27:40 UTC (rev 8549) @@ -101,51 +101,51 @@ ## inferiorto ("frd"); superiorto ("zpk", "tf", "double"); - argc = 0; # initialize argument count - tsam = 0; # initialize sampling time + argc = 0; # initialize argument count + tsam = 0; # initialize sampling time if (nargin == 1) - if (isa (a, "ss")) # already in ss form + if (isa (a, "ss")) # already in ss form sys = ss (sssys) sys = a; return; - elseif (isa (a, "lti")) # another lti object + elseif (isa (a, "lti")) # another lti object sys = ss (sys) [sys, alti] = __sys2ss__ (a); - sys.lti = alti; # preserve lti properties + sys.lti = alti; # preserve lti properties return; - elseif (is_real_matrix (a)) # static gain sys = ss (5) + elseif (is_real_matrix (a)) # static gain sys = ss (5), sys = ss (matrix) d = a; a = []; else print_usage (); endif - elseif (nargin > 4) # default case sys = ss (a, b, c, d, "prop1", val1, ...) - argc = numel (varargin); # number of additional arguments after d - if (issample (varargin{1}, -10)) # sys = ss (a, b, c, d, tsam, "prop1, "val1", ...) - tsam = varargin{1}; - argc--; - if (argc > 0) - varargin = varargin(2:end); + elseif (nargin > 4) # default case sys = ss (a, b, c, d, "prop1", val1, ...) + argc = numel (varargin); # number of additional arguments after d + if (issample (varargin{1}, -10)) # sys = ss (a, b, c, d, tsam, "prop1, "val1", ...) + tsam = varargin{1}; # sampling time, could be 0 as well + argc--; # tsam is not a property-value pair + if (argc > 0) # if there are any properties and values ... + varargin = varargin(2:end); # remove tsam from property-value list endif endif - endif # nothing to do for ss (), ss (a, b), ss (a, b, c), ss (a, b, c, d) + endif # nothing to do for ss (), ss (a, b), ss (a, b, c), ss (a, b, c, d) [a, b, c, d, tsam] = __adjust_ss_data__ (a, b, c, d, tsam); - [p, m, n] = __ss_dim__ (a, b, c, d); + [p, m, n] = __ss_dim__ (a, b, c, d); # determine number of outputs, inputs and states - stname = repmat ({""}, n, 1); + stname = repmat ({""}, n, 1); # cell with empty state names ssdata = struct ("a", a, "b", b, "c", c, "d", d, "e", [], "stname", {stname}, - "scaled", false); + "scaled", false); # struct for ss-specific data - ltisys = lti (p, m, tsam); + ltisys = lti (p, m, tsam); # parent class for general lti data - sys = class (ssdata, "ss", ltisys); + sys = class (ssdata, "ss", ltisys); # create ss object - if (argc > 0) - sys = set (sys, varargin{:}); + if (argc > 0) # if there are any properties and values, ... + sys = set (sys, varargin{:}); # use the general set function endif endfunction Modified: trunk/octave-forge/main/control/inst/@tf/tf.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/tf.m 2011-09-17 05:34:35 UTC (rev 8548) +++ trunk/octave-forge/main/control/inst/@tf/tf.m 2011-09-18 07:27:40 UTC (rev 8549) @@ -84,28 +84,28 @@ ## inferiorto ("frd", "ss", "zpk"); # error if de-commented. bug in octave? superiorto ("double"); - argc = 0; + argc = 0; # initialize argument count switch (nargin) - case 0 - tsam = -2; - tfvar = "x"; # undefined + case 0 # sys = tf () + tsam = -2; # undefined sampling time + tfvar = "x"; # undefined transfer function variable case 1 - if (isa (num, "tf")) # already in tf form + if (isa (num, "tf")) # already in tf form sys = tf (tfsys) sys = num; return; - elseif (isa (num, "lti")) # another lti object + elseif (isa (num, "lti")) # another lti object sys = tf (sys) [sys, numlti] = __sys2tf__ (num); sys.lti = numlti; # preserve lti properties return; - elseif (is_real_matrix (num)) # static gain + elseif (is_real_matrix (num)) # static gain sys = tf (4), sys = tf (matrix) num = num2cell (num); num = __vec2tfpoly__ (num); [p, m] = size (num); - den = tfpolyones (p, m); - tsam = -2; - tfvar = "x"; # undefined + den = tfpolyones (p, m); # denominators are all 1 + tsam = -2; # undefined sampling time + tfvar = "x"; # undefined transfer function variable elseif (ischar (num)) # s = tf ("s") tfvar = num; num = __vec2tfpoly__ ([1, 0]); @@ -128,44 +128,39 @@ tsam = 0; endif - otherwise # default case + otherwise # default case sys = tf (num, den, ...) num = __vec2tfpoly__ (num); den = __vec2tfpoly__ (den); - argc = numel (varargin); - + argc = numel (varargin); # number of additional arguments after num and den if (issample (varargin{1}, -10)) # sys = tf (num, den, tsam, "prop1", val1, ...) - tsam = varargin{1}; - argc--; - + tsam = varargin{1}; # sampling time, could be 0 as well + argc--; # tsam is not a property-value pair if (tsam == 0) tfvar = "s"; else tfvar = "z"; endif - - if (argc > 0) - varargin = varargin(2:end); + if (argc > 0) # if there are any properties and values ... + varargin = varargin(2:end); # remove tsam from property-value list endif else # sys = tf (num, den, "prop1", val1, ...) - tsam = 0; + tsam = 0; # continuous-time tfvar = "s"; endif - endswitch + [p, m] = __tf_dim__ (num, den); # determine number of outputs and inputs - [p, m] = __tf_dim__ (num, den); - tfdata = struct ("num", {num}, "den", {den}, - "tfvar", tfvar); + "tfvar", tfvar); # struct for tf-specific data - ltisys = lti (p, m, tsam); + ltisys = lti (p, m, tsam); # parent class for general lti data - sys = class (tfdata, "tf", ltisys); + sys = class (tfdata, "tf", ltisys); # create tf object - if (argc > 0) - sys = set (sys, varargin{:}); + if (argc > 0) # if there are any properties and values, ... + sys = set (sys, varargin{:}); # use the general set function endif endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |